i need to make my storedprocedure update as as the messabox reads each item of a datagridview. it only save the last record that messagebox read. need help:(
For Each row As DataGridViewRow In DataGridView1.Rows
Dim strunitprice As String = CDbl(row.Cells(7).FormattedValue) + Val(CDbl(TXTNET.Text))
'opening the connection
x = MessageBox.Show(CDbl(row.Cells(7).FormattedValue) + Val(CDbl(TXTNET.Text)))
If x = DialogResult.OK Then
Label27.Text = CDbl(row.Cells(7).FormattedValue) + Val(CDbl(TXTNET.Text))
End If
Dim dr5 As SqlDataReader
Dim myCommand As SqlCommand
connectme.Open()
myCommand = New SqlCommand("Select * from quotation", connectme)
dr5 = myCommand.ExecuteReader()
While dr5.Read()
connectme1.Close()
Dim c As New SqlCommand("updatequotation", connectme1)
Dim Adapter As SqlDataAdapter = New SqlDataAdapter(c)
c.CommandType = CommandType.StoredProcedure
c.Parameters.Add("@Customer_Name", SqlDbType.NVarChar).Value = txtclientname.Text
c.Parameters.Add("@Date_Today", SqlDbType.VarChar).Value = Label7.Text
c.Parameters.Add("@Net_Income", SqlDbType.VarChar).Value = TXTNET.Text
c.Parameters.Add("@Unit_Price", SqlDbType.VarChar).Value = Label27.Text
connectme1.Open()
c.ExecuteNonQuery()
connectme1.Close()
End While
dr5.Close()
connectme.Close()
Next row
End If