Answer Question
how to update all row from Datagrid to Databse table?if using for loop
Try
If DataGridView1.RowCount = 0 Then
MsgBox(" No More Products!Update Not Possible")
Else
Dim cmd As New SqlCommand
cmd.Connection = con
cmd.Connection.Close()
cmd.Connection.Open()
Dim c As String
For i = 0 To DataGridView1.Rows.Count
i = DataGridView1.CurrentRow.Index
'For i As Integer = 0 To DataGridView1.Rows.Count - 1
' c = DataGridView1.CurrentRow.
' 'c = DataGridView1.Item(0, i).Value
c = DataGridView1.Item(0, i).Value
cmd.CommandText = "Update receipt_detail set locating_rule='" & Me.ComboBox1.Text & "' where item='" & c & "' and Receipt_id='" & Label9.Text & "'"
cmd.ExecuteNonQuery()
Next
cmd.Connection.Close()
MsgBox("Updated Successfully")
End If
Catch ex As Exception
MsgBox("Updated Not Successfull")
End Try
End Sub
TEXT
Uploading file and scanning for virus...
Please Wait