Updating Records from grid control

victor64

Well-known member
Joined
Nov 9, 2008
Messages
60
Programming Experience
Beginner
Hello,

I am trying to update a databse using a grid control, I've enetered multiple rows in the row and tried to save the data, unfortunately I'm only saving the last row entered, is there a way to save all the rows entered using this approach?

Thanks

Victor

Code:

Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\aop29.mdb"
Dim objConnection As New OleDb.OleDbConnection(ConnectionString)
Dim sql As String = "Select * from Customer"
Dim daaop5 As New OleDb.OleDbDataAdapter(sql, objConnection)
Dim ds As New DataSet()
daaop5.Fill(ds)
daaop5.Update(ds)
C1TrueDBGrid1.AllowAddNew = True
daaop5.SelectCommand.CommandText = ("INSERT INTO Customer(Description) VALUES('" & C1TrueDBGrid1.Columns(0).Value & "')")
ds.Clear()
daaop5.Update(ds)
daaop5.Fill(ds)
 

Latest posts

Back
Top