S
Sajid
Hello! Experts,
I have the following piece of code in VB.NET that I want to use to
update any records in the database. I would like to use a code as well
as DataGrid to update the records. Please guide me how can I achieve
it. I know there is an Update command to to do this that but since I
am a newbie I don't know how? I'll be really grateful to those who may
help me buy modifying the following code. I am really desperately
looking for your help. I know this will only take a fraction of your
time but it will be a very big help for me. Thanks to all...
------------------------------------------------------------------------
Private odbcAd As New Microsoft.Data.Odbc.OdbcDataAdapter
Private Conn As New Microsoft.Data.Odbc.OdbcConnection
Private ds As New DataSet("AnyTable")
Conn.ConnectionString = "DSN=TestDSN"
Conn.Open()
Dim SQL As String
SQL = "SELECT * FROM AnyTable"
odbcAd = New Microsoft.Data.Odbc.OdbcDataAdapter(SQL, Conn)
ds.Clear()
odbcAd.Fill(ds, "AnyTable")
DataGrid1.SetDataBinding(ds, "AnyTable")
ds.Tables("AnyTable").Rows(1).Item(3) = "Test"
------------------------------------------------------------
I have the following piece of code in VB.NET that I want to use to
update any records in the database. I would like to use a code as well
as DataGrid to update the records. Please guide me how can I achieve
it. I know there is an Update command to to do this that but since I
am a newbie I don't know how? I'll be really grateful to those who may
help me buy modifying the following code. I am really desperately
looking for your help. I know this will only take a fraction of your
time but it will be a very big help for me. Thanks to all...
------------------------------------------------------------------------
Private odbcAd As New Microsoft.Data.Odbc.OdbcDataAdapter
Private Conn As New Microsoft.Data.Odbc.OdbcConnection
Private ds As New DataSet("AnyTable")
Conn.ConnectionString = "DSN=TestDSN"
Conn.Open()
Dim SQL As String
SQL = "SELECT * FROM AnyTable"
odbcAd = New Microsoft.Data.Odbc.OdbcDataAdapter(SQL, Conn)
ds.Clear()
odbcAd.Fill(ds, "AnyTable")
DataGrid1.SetDataBinding(ds, "AnyTable")
ds.Tables("AnyTable").Rows(1).Item(3) = "Test"
------------------------------------------------------------