W
whaletyr
When I try to update an access database using the commandbuilder and
updatecommand. I get the
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred
in system.data.dll
error message.
The strange thing is that only half of the table's give this error and the
other half of the tables seem to work just fine using the same code (except
other sql string always SELECT * FROM TABLE)
ANy Idea what goes wrong her or what I can do to eliminate this problem.
(Except for remaking all tables)
Here is my code
Dim STARTYPEtable As DataTable
Dim constring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents and Settings\Administrator\My
Documents\QUEST.mdb;Persist Security Info=False"
Dim condb As New OleDb.OleDbConnection(constring)
Dim DASTARTYPE As New OleDb.OleDbDataAdapter("SELECT * FROM STAR_TYPE",
condb)
Dim DBSTARTYPE As New OleDb.OleDbCommandBuilder(DASTARTYPE)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
DASTARTYPE.InsertCommand = DBSTARTYPE.GetInsertCommand
DASTARTYPE.UpdateCommand = DBSTARTYPE.GetUpdateCommand
DASTARTYPE.DeleteCommand = DBSTARTYPE.GetDeleteCommand
STARTYPEtable = New DataTable
DASTARTYPE.Fill(STARTYPEtable)
DataGrid1.DataSource = STARTYPEtable
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
DASTARTYPE.Update(STARTYPEtable)
End Sub
updatecommand. I get the
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred
in system.data.dll
error message.
The strange thing is that only half of the table's give this error and the
other half of the tables seem to work just fine using the same code (except
other sql string always SELECT * FROM TABLE)
ANy Idea what goes wrong her or what I can do to eliminate this problem.
(Except for remaking all tables)
Here is my code
Dim STARTYPEtable As DataTable
Dim constring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Documents and Settings\Administrator\My
Documents\QUEST.mdb;Persist Security Info=False"
Dim condb As New OleDb.OleDbConnection(constring)
Dim DASTARTYPE As New OleDb.OleDbDataAdapter("SELECT * FROM STAR_TYPE",
condb)
Dim DBSTARTYPE As New OleDb.OleDbCommandBuilder(DASTARTYPE)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
DASTARTYPE.InsertCommand = DBSTARTYPE.GetInsertCommand
DASTARTYPE.UpdateCommand = DBSTARTYPE.GetUpdateCommand
DASTARTYPE.DeleteCommand = DBSTARTYPE.GetDeleteCommand
STARTYPEtable = New DataTable
DASTARTYPE.Fill(STARTYPEtable)
DataGrid1.DataSource = STARTYPEtable
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
DASTARTYPE.Update(STARTYPEtable)
End Sub