radumaster
New member
- Joined
- Dec 2, 2007
- Messages
- 1
- Programming Experience
- Beginner
Hi.
I`m a beginner in vb.net database programming.
I am trying to update a database using a data adaptor and a dataset. Teh information gets to the dataset but doesn`t get to the database. What am I doing wrong?
Again, the dataset updates itself but the database doesn't.
Please help me if you can!
Many thanks.
I`m a beginner in vb.net database programming.
I am trying to update a database using a data adaptor and a dataset. Teh information gets to the dataset but doesn`t get to the database. What am I doing wrong?
VB.NET:
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;data source=mydb.mdb"
con.Open()
da.Fill(ds, "myname")
sql = "my string"
da = New OleDb.OleDbDataAdapter(sql, con)
Dim cb As OleDb.OleDbCommandBuilder = new OleDb.OleDbCommandBuilder(da)
ds.Tables("myname").Rows(i).Item(1) = txt1.Text
ds.Tables("myname").Rows(i).Item(2) = txt2.Text
da.Update(ds, "myname")
MsgBox("Data updated!")
Please help me if you can!
Many thanks.