title: i have with following code The parameterized query
body: <pre><code>For i = 0 To DataGridView2.Rows.Count - 1 Step +1
      Dim cmd As New SqlCommand("Insert into Installation_Report(From_Date,To_Date,Branch_Code,Branch_Name,Sector_Name,Region_Name,Same_Day,Next_Day,After_Two_Days,Same_Week,Not_Installed_Yet) values (@From_Date,@To_Date,@Branch_Code,@Branch_Name,@Sector_Name,@Region_Name,@Same_Day,@Next_Day,@After_Two_Days,@Same_Week,@Not_Installed_Yet)", connsqlserver)
  
      cmd.Parameters.Add("From_Date", SqlDbType.Date).Value = DateTimePicker1.Value
      cmd.Parameters.Add("To_Date", SqlDbType.Date).Value = DateTimePicker2.Value
      cmd.Parameters.Add("Branch_Code", SqlDbType.Int).Value = DataGridView2.Rows(i).Cells(0).Value
      cmd.Parameters.Add("Branch_Name", SqlDbType.NVarChar).Value = DataGridView2.Rows(i).Cells(1).Value
      cmd.Parameters.Add("Sector_Name", SqlDbType.NVarChar).Value = DataGridView2.Rows(i).Cells(2).Value
      cmd.Parameters.Add("Region_Name", SqlDbType.NVarChar).Value = DataGridView2.Rows(i).Cells(3).Value
      cmd.Parameters.Add("Same_Day", SqlDbType.Int).Value = DataGridView2.Rows(i).Cells(4).Value
      cmd.Parameters.Add("Next_Day", SqlDbType.Int).Value = DataGridView2.Rows(i).Cells(5).Value
      cmd.Parametersstrong text.Add("After_Two_Days", SqlDbType.Int).Value = DataGridView2.Rows(i).Cells(6).Value
      cmd.Parameters.Add("Same_Week", SqlDbType.Int).Value = DataGridView2.Rows(i).Cells(7).Value
      cmd.Parameters.Add("Not_Installed_Yet", SqlDbType.Int).Value = DataGridView2.Rows(i).Cells(8).Value
      connsqlserver.Open()
      cmd.ExecuteNonQuery()
      connsqlserver.Close()
      cmd = Nothing
  </code></pre>
  
  <p>I am facing problem with this code as  it gave me the following message</p>
  
  <blockquote>
    <p>The parameterized query '(@From_Date date,@To_Date date,@Branch_Code int,@Branch_Name nva' expects the parameter '@Branch_Code', which was not supplied.</p>
  </blockquote>