16-01-20, 11:14 PM
ممكن مساعدة
Private Sub ToolStripButton6_Click(sender As Object, e As EventArgs) Handles ToolStripButton6.Click
Connect()
Dim Str As String
Dim cmd As New SqlCommand
For index As Integer = 0 To DataGridView1.RowCount - 1
cmd.Connection = Connection
Str = "insert into liste_pv(id_proces_v,nom_pv,attab values (@1,@2,@3)"
cmd.CommandText = Str
cmd.Connection = Connection
cmd.Parameters.AddWithValue("@1", DataGridView1.Rows(Index).Cells(0).Value)
cmd.Parameters.AddWithValue("@2", DataGridView1.Rows(index).Cells(1).Value)
cmd.Parameters.AddWithValue("@3", DataGridView1.Rows(index).Cells(2).Value)
cmd.ExecuteNonQuery()
cmd.Dispose()
Connection.Close()
DataGridView1.Refresh()
Next
MsgBox("تمت عمليةالحفظ ")
End Sub
تظهر رسالة الخطا التالية
System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'values'.'
بارك الله فيكم
Private Sub ToolStripButton6_Click(sender As Object, e As EventArgs) Handles ToolStripButton6.Click
Connect()
Dim Str As String
Dim cmd As New SqlCommand
For index As Integer = 0 To DataGridView1.RowCount - 1
cmd.Connection = Connection
Str = "insert into liste_pv(id_proces_v,nom_pv,attab values (@1,@2,@3)"
cmd.CommandText = Str
cmd.Connection = Connection
cmd.Parameters.AddWithValue("@1", DataGridView1.Rows(Index).Cells(0).Value)
cmd.Parameters.AddWithValue("@2", DataGridView1.Rows(index).Cells(1).Value)
cmd.Parameters.AddWithValue("@3", DataGridView1.Rows(index).Cells(2).Value)
cmd.ExecuteNonQuery()
cmd.Dispose()
Connection.Close()
DataGridView1.Refresh()
Next
MsgBox("تمت عمليةالحفظ ")
End Sub
تظهر رسالة الخطا التالية
System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'values'.'
بارك الله فيكم