title: "Error converting" numeric input to correct TSQL type (possible Bug)
body: <p>As of now I am encountering this kind of bug</p>
  
  <blockquote>
    <p>Error converting data type float to decimal.</p>
  </blockquote>
  
  <p>or </p>
  
  <blockquote>
    <p>Error converting data type Numeric to decimal</p>
  </blockquote>
  
  <p>This is my code</p>
  
  <pre><code>using (SqlConnection reportsConn = new SqlConnection(sqlConnWriter))
  {
              reportsConn.Open();
              SqlCommand AddReconItem = new SqlCommand();
              AddReconItem.Connection = reportsConn;
              AddReconItem.CommandType = CommandType.StoredProcedure;
              AddReconItem.CommandText = "Updater.usp_AddReconcileItems";
             // AddReconItem.Parameters.Add("@varible",SqlDbType.Decimal
              AddReconItem.Parameters.AddWithValue("@ITEMWEIGHT", Math.Round(Convert.ToDouble(WeightTextBox.Text+".00"), 2));
              AddReconItem.Parameters.AddWithValue("@ITEMPRINCIPALAMT", Math.Round(Convert.ToDouble(PrincipalTexAmTextBox.Text + ".00"), 2));
              AddReconItem.Parameters.AddWithValue("@FORLOANMONTH", Convert.ToDateTime(YearDropDownList.SelectedValue + "/" + MonthDropDownList.SelectedValue));
              AddReconItem.Parameters.AddWithValue("@STORAGEGROUPID", StorageNameDropDownList.SelectedValue);
              AddReconItem.Parameters.AddWithValue("@BRANCHCODE",BranchCodeTextBox.Text);
              AddReconItem.Parameters.AddWithValue("RECONID", ReconTypeDropDownList.SelectedValue);
              AddReconItem.Parameters.AddWithValue("@PAWNTIX",PwnTicketTextBox.Text);
              AddReconItem.Parameters.AddWithValue("@CREATEDBY", Session["UserID"].ToString());
              AddReconItem.ExecuteNonQuery();
  }
  </code></pre>
  
  <p>When I input, <code>123</code> for <code>principalamt</code> and <code>itemweight</code> it accepts the answer and treats it as a decimal, but when I input <code>1234</code> for <code>itemweight</code> and still <code>123</code> for <code>Principalamt</code> it shows that error, if I remove the conversion and change it to <code>Convert.ToDecimal</code> it shows <code>Error converting data type Numeric to decimal</code> if I use it as text it shows <code>Error converting data type varchar to decimal</code></p>
  
  <p>Is this a bug or something? I can't seem to find a way I tried many options but none of them have been working</p>
  
  <p>My database columns are below:</p>
  
  <p>I really hope you can help me understand this phenomenon</p>
  
  <p><strong>EDIT</strong><br>
  This is the first time I saw a program accepting 123 as a valid input while 1234 is not, my database <code>Decimal (38,6)</code> is very large enough to accommodate this input that's why I'm looking for the answer or known bugs that can solve this problem, thank you.</p>