The parameterized query expects the parameter which was not supplied where the value is not null
<p>I have a problem with updating a SQL Server table from a DataGridView in the VB.Net, I know that the exception that I had is because of Null value but I'm sure that the value is set with a valid value, here is the code:</p>

<pre><code>cmd.CommandText = _
    "update BillItem set Item=@item1,Quantity=@q1,Price=@price1,TotalPrice=@tp1,BillID=@billId1 where Id=@id1"
cmd.Parameters.Add("@item1", SqlDbType.NVarChar)
cmd.Parameters.Add("@q1", SqlDbType.Int)
cmd.Parameters.Add("@price1", SqlDbType.Float)
cmd.Parameters.Add("@tp1", SqlDbType.Float)
cmd.Parameters.Add("@billId1", SqlDbType.Int)
cmd.Parameters.Add("@Id1", SqlDbType.Int)

connection.Open()
cmd.Connection = connection

For i As Integer = 0 To 1
    cmd.Parameters(0).Value = DataGridView1.Rows(i).Cells(1).Value
    cmd.Parameters(1).Value = DataGridView1.Rows(i).Cells(2).Value
    cmd.Parameters(2).Value = DataGridView1.Rows(i).Cells(3).Value
    cmd.Parameters(3).Value = Integer.Parse(DataGridView1.Rows(i).Cells(2).Value) * Double.Parse(DataGridView1.Rows(i).Cells(3).Value)
    cmd.Parameters(4).Value = Integer.Parse(CurrentBillIDLbl.Text)
    cmd.Parameters(5).Value = DataGridView1.Rows(i).Cells(0).Value
    cmd.ExecuteNonQuery()
Next
connection.Close()
</code></pre>

<p>Here is the exception:</p>

<blockquote>
  <p>An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll<br>
  Additional information: The parameterized query '(@item nvarchar(4),@quantity int,@price float,@tp float,@billId ' expects the parameter '@q1', which was not supplied.</p>
</blockquote>