Failed To Convert Parameter Value From A String To A Int32

后端 未结 3 1842
我在风中等你
我在风中等你 2021-01-19 00:35

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

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-19 00:56

    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?

提交回复
热议问题