语法错误 (操作符丢失) 在查询表达式 'classid=' 中。

asp.net源代码为:string strsql = "select count(*) from Newclass where newClassname='" + n.Text + "' and classid <>" +DataGrid1.DataKeys[e.Item.ItemIndex];

运行出错提示:语法错误 (操作符丢失) 在查询表达式 'newClassname='娱乐新闻' and classid <>' 中。

帮小弟个忙..
谢谢大家了..

string strsql = "select count(*) from Newclass where newClassname='" + n.Text + "' and classid <>"+DataGrid1.DataKeys[e.Item.ItemIndex]+"";

这样肯定可以了
温馨提示:内容为网友见解,仅供参考
第1个回答  2007-06-21
string strsql = "select count(*) from Newclass where newClassname='" + n.Text + "' and classid <>'"+DataGrid1.DataKeys[e.Item.ItemIndex]+"'";
第2个回答  2007-06-21
asp.net源代码为:string strsql = "select count(*) from Newclass where newClassname='" + n.Text + "' and classid <>"' +DataGrid1.DataKeys[e.Item.ItemIndex]+'"';
第3个回答  2007-06-21
温柔也是错回答的是正确的
因为id是整型的,所以不需要加2个单引号
相似回答
大家正在搜