3
Answers

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

Aamir Khan

Aamir Khan

12y
3.7k
1
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)