DataGrid Updates DataSet and Database (Not!)

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.
 
C

Cor Ligthert [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top