DataGrid Updates DataSet and Database (Not!)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Am i missing something blatently obvious?

1.) I have dragged a SQLdataConnection & SQLDataAdaptor to the screen where
my DataGrid is. My DataAdaptor is configred for updates (see end of thread)
and my table has a Primary Key.

2.) I have generated a dataset from my Adaptor. Everything is connected.

3.) I load my datagrid as follows:
Try
cn = New SqlClient.SqlConnection("user id=" & UserName.Text & ";password="
& Password.Text & ";database=" & Database.Text & ";server=" & Server.Text)
cn.Open()
cmdSelect.Connection = cn

Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter("Select
* from MISRE_Threshold", cn)

Dim dsThreshold As DataSet = New DataSet

' fill dataset
da.Fill(dsThreshold, "MISRE_Threshold")

'Attach DataSet to DataGrid
dgThreshold.DataSource = dsThreshold.DefaultViewManager

Catch ex As Exception
MessageBox.Show("Error: Could not establish database connection")
End Try

4.) I make modifications to my dataGrid and press save which fires this code:

Me.BindingContext(DataSet11).EndCurrentEdit()
SqlDataAdapter1.Update(DataSet11)
DataSet11.AcceptChanges()

5.) None of the updates are written.

HELP HELP HELP HELP
Pulling hair out.
 
Marc,

Please don't start new trheads, if somebody can take an question up in an
continuing thread he does it.

I gave you an answer in your original thread

Cor
 
Back
Top