错误提示:在此上下文中不允许使用名称 "***"。有效表达式包括常量、 常量表达式和变量(在某些上下文中),不允许使用列名。

时间:2014-12-23 23:55:09   收藏:0   阅读:501

出现这种情况的原因,是因为在SQL语句的编写格式不正确。

 

事例展示:

 

错误:

1 string sql = "insert into person ([name], sex, salary) values (‘text_name ‘, ‘text_sex ‘, text_salary )";

 

正确:

1 string sql = "insert into person ([name], sex, salary) values (‘" + text_name + "‘, ‘" + text_sex + "‘, ‘" + text_salary + "‘)";

 

原文:http://www.cnblogs.com/KTblog/p/4181373.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!