Dim product_id As String
Dim descript As String
Dim descripte As String
Dim t_type As String
Dim pro_unit As String
Dim pro_qty As Integer
Dim price_stock As Double
Dim price_amount As Double
Dim percent_dis As Double
Dim amount_dis As Double
Dim amt_after_dis As Double
Dim vat_amt As Double
Dim amt_total As Double
Dim record_id As Integer
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
For i As Integer = 0 To MyDataGridView1.Rows.Count - 1
product_id = MyDataGridView1.Rows(i).Cells(1).Value
descript = MyDataGridView1.Rows(i).Cells(2).Value
descripte = MyDataGridView1.Rows(i).Cells(3).Value
t_type = MyDataGridView1.Rows(i).Cells(4).Value
pro_unit = MyDataGridView1.Rows(i).Cells(5).Value
pro_qty = MyDataGridView1.Rows(i).Cells(6).Value
price_stock = MyDataGridView1.Rows(i).Cells(7).Value
price_amount = MyDataGridView1.Rows(i).Cells(8).Value
percent_dis = MyDataGridView1.Rows(i).Cells(9).Value
amount_dis = MyDataGridView1.Rows(i).Cells(10).Value
amt_after_dis = MyDataGridView1.Rows(i).Cells(11).Value
vat_amt = MyDataGridView1.Rows(i).Cells(12).Value
amt_total = MyDataGridView1.Rows(i).Cells(13).Value
' record_id = DGV_TRANS.Rows(i).Cells(14).Value
sql = "insert into dbo.Sacc_Trans_Item values(@dt,@certify_no,@pd_id,@trans_descrip,@trans_descripe,@type_nm,@unit,@qty,@stock_amt,@amt,@disc_percent,@disc,@amt_disc,@amt_vat,@amt_total)"
cm = New SqlCommand(sql, Connt)
cm.Parameters.AddWithValue("@dt", Format(CDate(dtpDate.Text), "yyyy-MM-dd"))
cm.Parameters.AddWithValue("@certify_no", txtcertify_no.Text)
cm.Parameters.AddWithValue("@pd_id", product_id)
cm.Parameters.AddWithValue("@trans_descrip", descript)
cm.Parameters.AddWithValue("@trans_descripe", descripte)
cm.Parameters.AddWithValue("@type_nm", t_type)
cm.Parameters.AddWithValue("@unit", pro_unit)
cm.Parameters.AddWithValue("@qty", pro_qty)
cm.Parameters.AddWithValue("@stock_amt", price_stock)
cm.Parameters.AddWithValue("@amt", price_amount)
cm.Parameters.AddWithValue("@disc_percent", percent_dis)
cm.Parameters.AddWithValue("@disc", amount_dis)
cm.Parameters.AddWithValue("@amt_disc", amt_after_dis)
cm.Parameters.AddWithValue("@amt_vat", vat_amt)
cm.Parameters.AddWithValue("@amt_total", amt_total)
cm.ExecuteNonQuery()
cm.Dispose()
Next
MsgBox("save")
End Sub