Hi all
I've successfully used the following code to populate a datatable from my MS Access database
Now, I'd like to use a similar method to push changes back to the database, having done them to the datatable...
I was thinking I'd be able to do something like this but it doesn't seem to work...
Any thoughts?
I've successfully used the following code to populate a datatable from my MS Access database
VB.NET:
strMSAccess_Connection_SQL = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDatabaseFilePath & ";Persist Security Info=True"
MSAccess_Connection = New OleDbConnection(strMSAccess_Connection_SQL)
MSAccess_Connection.Open()
strDatabaseTable_SQL = "SELECT * FROM [" & strDatabaseTable & "]"
If (strDatabaseTable_SQLWhere <> "") Then
strDatabaseTable_SQL = strDatabaseTable_SQL & " " & strDatabaseTable_SQLWhere
End If
MSAccess_Database_Adapter = New OleDbDataAdapter(strDatabaseTable_SQL, MSAccess_Connection)
MSAccess_Database_Adapter.Fill(MSAccess_DatabaseTable)
Now, I'd like to use a similar method to push changes back to the database, having done them to the datatable...
I was thinking I'd be able to do something like this but it doesn't seem to work...
VB.NET:
strMSAccess_Connection_SQL = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDatabaseFilePath & ";Persist Security Info=True"
MSAccess_Connection = New OleDbConnection(strMSAccess_Connection_SQL)
MSAccess_Connection.Open()
strDatabaseTable_SQL = "SELECT * FROM [" & strDatabaseTable & "]"
If (strDatabaseTable_SQLWhere <> "") Then
strDatabaseTable_SQL = strDatabaseTable_SQL & " " & strDatabaseTable_SQLWhere
End If
MSAccess_Database_Adapter = New OleDbDataAdapter(strDatabaseTable_SQL, MSAccess_Connection)
MSAccess_Database_Adapter.AcceptChangesDuringUpdate = True
MSAccess_Database_Adapter.Update(MSAccess_DatabaseTable)
Any thoughts?