0

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,

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by tqmd1
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.