I use:
Visual studio 8.0
MySql database
One table:
table :Groups, two fields : groupnb,groupdef
One Datagridview with is link to Mydataset1
Some times a get this MySQL error:
"Connection must be valid and open"
I use first this command :
MyDataset1.Tables("groups").Rows.InsertAt(row, 0)
Then I change the content of some fields in Datagridview1
Then i use this command, see code :
90% of the time goes well,i get no error
How can I avoid getting this error message!
If MyDataset1.GetChanges() Is Nothing Then
MessageBox.Show("No record are changed")
Else
Dim rowsAffected As Integer = myAdapter1.Update(MyDataTable1)
If rowsAffected = 0 Then
MessageBox.Show("No record are changed")
Else
MessageBox.Show(rowsAffected & " Records are changed")
End If
End If