Hello, I have a datatable and oledbdataadapter on my class. I need to update datagridview contents when Form1 closes. I tried adding / removing dataset but got the same result.
Code:
dbOp.daProgramList.Update(dbOp.dtProgrmList)
Isn't this enough for updating a database?
The variables are declared my DatabaseOperations class like this:
Code:
Public Property dtProgramList As DataTable
Protected Friend Property Connection As New OleDbConnection
Public Property daProgramList As New OleDbDataAdapter
Public Function GetData(ByVal sqlCommand As String) As DataTable
If Not (Connection.State = ConnectionState.Open) Then
ConnectToDatabase()
End If
Dim command As New OleDbCommand(sqlCommand, Connection)
daProgramList = New OleDbDataAdapter()
daProgramList.SelectCommand = command
dtProgramList = New DataTable
dtProgramList.Locale = Globalization.CultureInfo.InvariantCulture
daProgramList.Fill(dtProgramList)
Return (dtProgramList)
End Function