title: Procedure expects parameter even though the parameter is provided
body: <p>I saw that some others faced this similar problem. I have read and checked the question titled <a href="https://stackoverflow.com/questions/368642/procedure-expects-parameter-which-was-not-supplied">Procedure expects parameter which was not supplied</a>. I thought it would solve my problem but I was wrong :( I did check the steps that were advised there with no luck. Here is my code:</p>
  
  <pre><code>oOleDbCommand.CommandText = "usp_PettyCash_AddBillInfo";
  oOleDbCommand.Parameters.Add("@BillID", OleDbType.BigInt).Value = nBillID;
  oOleDbCommand.Parameters.Add("@SerialNo", OleDbType.VarChar).Value = sSerialNo;
  oOleDbCommand.Parameters.Add("@UniqueID", OleDbType.VarChar).Value = oInputBill[0].UniqueID.ToString();
  oOleDbCommand.Parameters.Add("@BilledWeekDate", OleDbType.Date).Value = oInputBill[0].BilledWeekDate;
  oOleDbCommand.Parameters.Add("@BilledWeekNo", OleDbType.VarChar).Value = oInputBill[0].BilledWeekNo.ToString();
  oOleDbCommand.Parameters.Add("@SettledWeekDate", OleDbType.Date).Value = oInputBill[0].SettledWeekDate;
  oOleDbCommand.Parameters.Add("@SettledWeekNo", OleDbType.VarChar).Value = oInputBill[0].SettledWeekNo;
  oOleDbCommand.Parameters.Add("@BillStatus", OleDbType.VarChar).Value = oInputBill[0].BillStatus.ToString();
  oOleDbCommand.Parameters.Add("@UpdatedBy", OleDbType.VarChar).Value = oInputBill[0].UpdatedBy;
  oOleDbCommand.Parameters.Add("@UpdateDate", OleDbType.Date).Value = oInputBill[0].UpdateDate;
  </code></pre>
  
  <p>Stored Procedure is:</p>
  
  <pre><code>CREATE PROCEDURE usp_PettyCash_AddBillInfo 
  (
      @BillID bigint,
      @SerialNo varchar(50),
      @UniqueID varchar(50),
      @BilledWeekDate datetime,
      @BilledWeekNo varchar(50),
      @SettledWeekDate datetime,
      @SettledWeekNo varchar(50),
      @BillStatus varchar(50),
      @UpdatedBy varchar(50),
      @UpdateDate datetime 
  )
  AS
  
  BEGIN  
      INSERT INTO t_BillInfo (BillID, SerialNo, UniqueID, BilledWeekDate, BilledWeekNo, SettledWeekDate, SettledWeekNo, BillStatus, UpdatedBy, UpdateDate) 
      VALUES (@BillID, @SerialNo, @UniqueID, @BilledWeekDate, @BilledWeekNo, @SettledWeekDate, @SettledWeekNo, @BillStatus, @UpdatedBy, @UpdateDate) 
  END 
  
  GO
  </code></pre>
  
  <p>While debugging, i found the value of <code>nBillID = 1.0</code> and <code>sSerialNo='B201200001'</code>. But when trying to execute the <code>ExecuteNonQuery</code> command, it gives the exception:</p>
  
  <blockquote>
    <p>"Procedure 'usp_PettyCash_AddBillInfo' expects parameter '@BillID',
    which was not supplied."</p>
  </blockquote>
  
  <p>I can't find any workarounds. Please help. Sorry for re-asking the question.</p>
  
  <p>As a workaround, I used this:</p>
  
  <pre><code>oOleDbCommand.CommandText = "INSERT INTO t_BillInfo (BillID, SerialNo, UniqueID, BilledWeekDate, BilledWeekNo, SettledWeekDate, SettledWeekNo, BillStatus, UpdatedBy, UpdateDate)"+
  " VALUES (" + nBillID + ", '" + sSerialNo + "', '" + oInputBill[0].UniqueID.ToString() + "','" + oInputBill[0].BilledWeekDate.ToShortDateString() + "', '" + oInputBill[0].BilledWeekNo + "', '" + oInputBill[0].SettledWeekDate.ToShortDateString() + "', '" + oInputBill[0].SettledWeekNo + "', '" + oInputBill[0].BillStatus.ToString() + "', '" + oInputBill[0].UpdatedBy + "', '" + oInputBill[0].UpdateDate.ToShortDateString() + "')";
  </code></pre>
  
  <p>Although I did not like this type of coding, but this works.</p>