A datagridview control that bounds to ms access database.

I am adding more rows to gridview control. How can i save these data to database?

Any help would be greatly appreciated..

Thanks,

A datagridview control that bounds to ms access database.

I am adding more rows to gridview control. How can i save these data to database?

Any help would be greatly appreciated..

Thanks,

Dim str As String
Dim i As Integer
str = "insert into std(rollno,name,address) values("
str &= "" & Val(TextBox1.Text) & ",'" & Trim(TextBox2.Text) & "',"
str &= ".)"
ExecuteQuery(str)
For i = 0 To DGrid.Rows.Count - 2
str = "insert into marks(rollno,code,subject,marks) values("
str &= "" & Val(TextBox1.Text) & "," & Val(DGrid.Rows(i).Cells(0).Value) & ","
str &= "'" & Trim(DGrid.Rows(i).Cells(1).Value) & "',"
str &= "" & Val(DGrid.Rows(i).Cells(2).Value) & ")"
ExecuteQuery(str)
Next

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.