.AcceptChanges() is not what you want. It will cause your dataset to internally accept changes and you will end up with all your dataset.rows having a rowstate of unmodified.
On Thu, Aug 5, 2010 at 5:45 PM, Markei54545 <[email protected]> wrote: > I have done the following code to update a SQL database. It reads the > data fine but try as I might I can't get it to update the database. It > just doesn't do anything, no errors. > > Any ideas? Any help gratefully received. > > Dim ConnString2 As String > Dim SQLString2 As String > > ConnString2 = "Driver={SQL > Server};Server=SC000511\SQLEXPRESSR2;Trusted_Connection=Yes;Database=Belvoir;" > > SQLString2 = "SELECT * FROM stockItem " > > Dim cn2 As New Data.Odbc.OdbcConnection(ConnString2) > Dim cmd2 As New Data.Odbc.OdbcCommand(SQLString2, cn2) > Dim da2 As New Data.Odbc.OdbcDataAdapter(cmd2) > Dim ds2 As New Data.DataSet > da2.Fill(ds2) > > Dim dr2 As DataRow > > For Each dr2 In ds2.Tables(0).Rows > > dr2("Name") = "TEST" > > Next > ds2.Tables(0).AcceptChanges()
