Invalid cast exception when reading result from SQLDataReader

前端 未结 4 848
轻奢々
轻奢々 2021-02-19 05:31

My stored procedure:

    @UserName nvarchar(64),

    AS

    BEGIN
    SELECT MPU.UserName, SUM(TS.Monday)as Monday //TS.Monday contains float value
    FROM db         


        
4条回答
  •  北恋
    北恋 (楼主)
    2021-02-19 06:00

    float monday = Convert.ToDouble(reader["Monday"]);
    

    would be a nice approach. I am trying to find a solution for over an hour and it fails here. now it works fine.

提交回复
热议问题