Hello i\'ve a databse that i load to Datagridview in vb.net application. it loads fine, however when i try to save the date it doesn\'t work. here is the code
So you must define an InsertCommand for you DataAdapter
Side-note: The line DSet.AcceptChanges()
is redundant since the previous line Dadapter.Update
will call AcceptChanges
implicitely.
You should use using-statement
for anything implementing IDisposable
like a Connection. That would call Dispose
(which closes the connection) implicitely even in case of an exception.
So replace:
con.Open()
Dadapter.Update(DSet, "Table1")
DSet.AcceptChanges()
con.Close()
with
Using con = New OleDbConnection(myConString)
con .Open()
Dadapter.Update(DSet, "Table1")
End Using