Conversion failed when converting the varchar value 'Retail' to data type int.

Server Error in '/' Application.

Conversion failed when converting the varchar value 'Retail' to data type int.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.            

Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value 'Retail' to data type int.

  Source Error:

           

Line 66:             curpage = 1;
Line 67:         }Line 68:         Products = productBLL.GetDistributorViewList(out record, curpage, pagesize, "ProductAgentId Desc", where);Line 69: 
Line 70:         if (Products == null)
                     
                 
      


hierror T4 发布于1年前

最佳解决方案

原因分析

一般是Sql Server里面数据类型转换错误,按照提示消息是试图把字符串‘Retail’转换为int类型导致的报错

可以打印出SQL语句,对比数据库字段类型和条件参数类型。根据数据库字段类型,程序里面转换好后再传递给数据库执行查询

hierror T4 被采纳率67%
2022-01-06 09:52
打赏 0 0
页面统计
589 访问
0 帮助
0.00 打赏

hierror 2019 © hierror.com 京ICP备13026190号-1

通知消息
  • 暂无任何消息