Specified cast is not valid

后端 未结 2 1331
礼貌的吻别
礼貌的吻别 2021-01-12 17:44

I\'m trying to get the Score_Waarde value from my database using the following code :

critid = critid_arr[teller2].ToString();

int scorehulp =          


        
相关标签:
2条回答
  • 2021-01-12 18:01

    I was originally getting this error (my C# code

    someobject.TotalItemCount = (Int32)dbManager.GetParameterValue("TotalRows"))
    

    where TotalItemCount was of int type, even though the SP was fine & was giving proper result. I got rid of this just by fixing the SP by adding the following code

    Set @TotalRows =  @@rowcount.  
    
    0 讨论(0)
  • 2021-01-12 18:04

    Your SQL is probably giving back a different numeric type, such as long or decimal, or, apparently, string.

    Call Convert.ToInt32, which doesn't have the limitations of an unboxing cast.

    0 讨论(0)
提交回复
热议问题