I am currently trying to complete a transaction for a web based app, however;
Failed To Convert Parameter Value From A String To A Int32
I belive the problem is in your first paramter (storeCode). You're trying to send a string as an int paramter.
That line should read like this:
command.Parameters.Add("@storeCode", SqlDbType.Int).Value = Convert.ToInt32(storeCode);
There's one more suspicious thing: the parameter's name is storeCode, which implies a varchar column. What's the value you're trying to pass as a storeCode? Are you sure it's an int?
I would suggest you change the type of the parameters in the method.
to
public static void completeTransaction(int storeCode, int employeeId, DateTime Date, string itemListNoId)
and convert the strings before passing the values to the method.
One of the inputs is a string, check the declarations for:
storeCode
employeeId
itemListNoId
I imagine storeCode
is a string. You can fix this by parsing it as an Int
:
command.Parameters.Add("@storeCode", SqlDbType.Int).Value = int.Parse(storeCode);
However this will cause problems if storeCode
is ever no a parasable Int
.