奔腾不止
此后如竟没有炬火,我便是唯一的光......

 

转载自:https://www.cnblogs.com/zhjason/p/14046337.html

前面先单引,再双引;变量放中间,+号放左右;后面与前面配对,先双引,再单引。

如下:

    ' "+变量+" '

例:


写法1:

string sql = " select * from t_admin where Uid='"+textBox_username+"' and pwd='"+textBox_userpwd+"' ";

写法2:

string sql = $" select * from t_admin where Uid='{textBox_username}' and pwd='{textBox_userpwd}' ";
posted on 2021-02-25 13:56  奔腾不止  阅读(824)  评论(0编辑  收藏  举报