日期:2014-05-18 浏览次数:20524 次
sql = string.Format("select * from user where name='{0}'",Session["UserName"]);
------解决方案--------------------
sql="select * from user where name='"+Session["UserName"]+"'"
------解决方案--------------------
先把Session["UserName"]赋值到一个字符串,然后再拼串
------解决方案--------------------
"'"+Session{"UserName"].ToString+"'"
------解决方案--------------------
sql="select * from user where name='"+Session["UserName"].ToString+"'"
------解决方案--------------------
sql = "select * from user where name = '"+Session["UserName"].Tostring()+"'";
------解决方案--------------------
sql="select * from user where name='"+Session["UserName"]+"'"