[Solved] SQL – Failed to convert string to Int32


You are probably passing a value that can’t be parsed into an int for this parameter:

pram[5] = new SqlParameter("@contact", SqlDbType.Int, 100);

Check what you are passing here:

pram[5].Value = contact;

If contact is a string then do something like:

int contactNumber;
pram[5].Value = int.TryParse(contact, out contactNumber) ? contactNumber : 0;

4

solved SQL – Failed to convert string to Int32