例如:textbox1中的字符串是:FUCKingCSDN 这句的意思就是: SqlDbCommand1.CommandText="select a from b where c='FUCKingCSDN'";其实"select a from b where c='"是一个字符串,"'"是另一个字符串,加号是连接这三个字符串的操作符。
同意楼上,楼主你截取错了。 "select a from b where c='" +textbox1.text +"'" 这样看明白了没有?三个字符串相加。
SqlDbCommand1.CommandText="select a from b where c='"+ textbox1.text +"'";试理解如下: 将 "select a from b where c='"+ textbox1.text +"'" 字符串赋值给SqlDbCommand1.CommandText字符串分三部分: 1. "select a from b where c='" 2. textbox1.text 3. "'"然后用 + 把三部分连接起来see?
select a from b where c='"+ textbox1.text +"';
SqlDbCommand1.CommandText="select a from b where c='"+ textbox1.text +"'";
在SQL语句里用单引号引起的部分表示字符串,所以我觉得可能类似我上面写的语句。
'"+textbox1.text+"'谁能详细说明一下这个表达式的意思?
特别是单引号中间的双引号,还有两个"+"号是什么意思?
SqlDbCommand1.CommandText="select a from b where c='FUCKingCSDN'";其实"select a from b where c='"是一个字符串,"'"是另一个字符串,加号是连接这三个字符串的操作符。
"select a from b where c='"
+textbox1.text
+"'"
这样看明白了没有?三个字符串相加。
将 "select a from b where c='"+ textbox1.text +"'" 字符串赋值给SqlDbCommand1.CommandText字符串分三部分:
1. "select a from b where c='"
2. textbox1.text
3. "'"然后用 + 把三部分连接起来see?