Dear All:
Please can anybody help me to write a easy code to send changes of webgrid or ultrawebgrid to Sql Server 2005 Express ???
i wrote the follwoing code but nothing changes ?!!
Imports System.Data
Inherits System.Web.UI.Page
Private c_dataAdapter As New SqlClient.SqlDataAdapter
c_dataAdapter = New SqlClient.SqlDataAdapter("SELECT Project_ID,Project_Name,Region FROM Projects", dataConnection)
' create insert, delete and update commands
c_dataAdapter.InsertCommand = dataCommandBuilder.GetInsertCommand
c_dataAdapter.DeleteCommand = dataCommandBuilder.GetDeleteCommand
c_dataAdapter.UpdateCommand = dataCommandBuilder.GetUpdateCommand
' create temporary datatable
c_dataAdapter.Fill(tempDataTable)
' bind datatable to UltraGrid
UltraWebGrid1.DataSource = tempDataTable
UltraWebGrid1.DataBind()
End Sub
' get reference to grid datasource
' test for valid grid datasource
' send changes to database
c_dataAdapter.InsertCommand.Connection = dataConnection
c_dataAdapter.DeleteCommand.Connection = dataConnection
c_dataAdapter.UpdateCommand.Connection = dataConnection
c_dataAdapter.Update(gridDataTable)
Call Save_Data()
this code worked very good in windows forms but not worked in ASP.NET 3.5 and no error apeared just without saving data to database.
Please help me. >>>
Best Regards
Basheer Massarrani
Civil & Electro Mechanical
KSA-Jeddah
first thing thank you very much ,
i will read article then replay you.
The following article (the first of two parts) from our online Knowledge Base shows one way to approach database updating when using ADO.NET objects such as DataSets, DataTables, and DataAdapters:HOWTO: Database Updates with WebGrid events