I am having trouble updating my database table with datagridview, I've read some thread about the problem and nothing seem to work in my case. Here is the code i use when populating the datagridview.
Public Sub filldatagridserver(ByRef SQL As String, ByRef dg As DataGridView)
Dim myDataset As DataSet = New DataSet
myAdptr.SelectCommand = New SqlCommand(SQL, cnSQL)
myAdptr.Fill(myDataset)
dg.DataSource = myDataset.Tables(0)
dg.AutoResizeColumns()
myAdptr.Dispose()
myDataset.Dispose()
cnSQL.Close()
End Sub
then i call this sub procedure with the ff code:
Call filldatagridserver("SELECT * FROM tblQuarterCollection", dgQuarter)
i already used myAdptr.update but i keep getting error about table mapping etc. I also tried to quote out the dispose and close in that sub procedure but it still doesn't work.
is there anyway to properly populate the datagridview and update changes made to database. I think my last resort here would be looping thru each record the update the data according to current value in the datagridview. Please help.