Aamir Khan

Aamir Khan

  • NA
  • 277
  • 439.1k

Failed to convert parameter value from a String to a Int32.

Jun 22 2012 5:25 AM
Hi frnds,
i am getting the error:Failed to convert parameter value from a String to a Int32.
my code is like below

if(((TextBox)GridView1.Rows[i].FindControl("txtUnit")).Text == null ||((TextBox)GridView1.Rows[i].FindControl("txtUnit")).Text == "")

{

string Val = "0";

cmdInvDtls.Parameters.Add("@Units", SqlDbType.Int).Value = int.Parse(Val);

}

on cmdInvDtls.ExecuteNonQuery() the above errors generates


Answers (3)