In DataGridView1 form1, the inside of the data comes from the firebird database query (thanks to a bowl of "peace" to write program)
In the form1 DataGridView2, inside the data come from the SQL database query to see
I need to now DataGridView1 saved to the data from the SQL database
Please will of people in the busy time, help me see this online to find the code, thank you very much
Private Sub save _Click (ByVal sender As System. Object, ByVal e the As System. EventArgs) Handles saved. Click
Dim sqlStr As String="insert into the product values ("
Dim As Integer I
For I=0 To DataGridView1. Columns. The Count - 1
SqlStr & amp;="" & amp; CType (DataGridView1 Rows (DataGridView1. Rows. The Count - 1) Cells (I). The Value, the ToString) & amp; "
"If I & lt; DataGridView1. Columns. Then Count - 1 sqlStr & amp;=", "
Next
SqlStr & amp;=") "
Dim CMD As DBCommand command=New DBCommand command (New ConnectionString (). The ConnectionInfo)
If CMD. Insert (sqlStr) & gt; 0 Then
MsgBox (" save success!" , MsgBoxStyle. DefaultButton1, "business module")
The Else
MsgBox (" save failed! Please contact the system administrator, ")
End the If
End Sub
CodePudding user response:
This save event is the product you add a line of dataLines traverse DataGridView1 column number, take the last line of data, and take traversal of the number of columns,
CodePudding user response:
First you have to read to the data from the event and then saved to the database,You have a process problem,