您的位置:程序门 -> .net技术 -> asp.net



数据类型不匹配


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


数据类型不匹配[已结贴,结贴人:lshclshc]
发表于:2007-05-01 11:30:40 楼主
标准表达式中数据类型不匹配。  
说明:   执行当前   web   请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  

异常详细信息:   system.data.oledb.oledbexception:   标准表达式中数据类型不匹配。

源错误:  


行   29:   oledbcommand   cmd=new   oledbcommand( "select   articleid   from   product   where   articleid   = ' "+request.querystring[ "articleid "].tostring   ()+ " ' ",con);
行   30:   con.open   ();
行   31:   oledbdatareader   dr=cmd.EXECutereader   ();
行   32:   while(dr.read())
行   33:   {
 
急,,在线等呀,,,
发表于:2007-05-01 11:47:111楼 得分:5
articleid   如果是int类型时,给他赋值就不要使用单引号,改为
oledbcommand   cmd=new   oledbcommand( "select   articleid   from   product   where   articleid   = "+request.querystring[ "articleid "].tostring   ()+ "   ",con);
发表于:2007-05-01 11:48:502楼 得分:5
另外,从客户端request数据时,一定要验证数据是否合法
发表于:2007-05-01 11:53:583楼 得分:0
改了以后出现了,,不正常   guid。   在查询表达式   'articleid   ={0} '   中。  
发表于:2007-05-01 15:38:064楼 得分:5
注意下articleid的类型
发表于:2007-05-01 15:43:135楼 得分:5
如果articleid是int型的
oledbcommand   cmd=new   oledbcommand( "select   articleid   from   product   where   articleid   = "+convert.toint32(request.querystring[ "articleid "]) ",con);


快速检索

最新资讯
热门点击