请问where子句后边什么时候用单引号什么时候用双引号啊?
例如:select * from 表 where 保险单号 = '"+id.ToString+"';
其中单引号 双引号的用法是什么啊,+代表什么意思啊?select * from 表 where 姓名 = '"&name&"'; //姓名是varchar字符类型
其中 & 是什么意思啊?
例如:select * from 表 where 保险单号 = '"+id.ToString+"';
其中单引号 双引号的用法是什么啊,+代表什么意思啊?select * from 表 where 姓名 = '"&name&"'; //姓名是varchar字符类型
其中 & 是什么意思啊?
"select * from 表 where 姓名 = '" & name & "'"应该是VB的语句,&就是字符串相加的意思,等于C#中的+。
"select * from 表 where 姓名 = '张三'"SQL中的字符串是用单引号的。
select * from 表 where 保险单号 = '"+id.ToString+"';
该SQL应该是:"select * from 表 where 保险单号 = '"+id.ToString+"'"; 吧?
select * from 表 where 姓名 = '"&name&"';
应该是:"select * from 表 where 姓名 = '"&name&"'";吧?
这里的&应该是VB.net中的连字符,用于连接两边的字符串,生成新的字符串。+是C#中的语法。
例如:"select * from 表 where 保险单号 = '"+id.ToString+"'";
其中'"+id.ToString+"'中的单引号在数据库中已经表示为字符串,那为什么还在+id.ToString+ 上加上双引号啊?
如果还不明白, 真的无话可说...有书不好好看...-_-!!!