string newtime=Request.QueryString["time"];
if(newtime!=null)
sql1="select id,title,what,how,swhen,swhere,demand,Number,Price,about from [plan] where convert(varchar(10),stime,120) like '%newtime%' order by stime desc";
...全文
233打赏收藏
===这句时间查询的sql错在那里?
string newtime=Request.QueryString["time"]; if(newtime!=null) sql1="select id,title,what,how,swhen,swhere,demand,Number,Price,about from [plan] where convert(varchar(10),stime,120) like '%newtime%' order by stime desc";
sql1="select id,title,what,how,swhen,swhere,demand,Number,Price,about from [plan] where convert(varchar(10),stime,120) like '%" & newtime & "%' order by stime desc";
sql1="select id,title,what,how,swhen,swhere,demand,Number,Price,about from [plan] where convert(varchar(10),stime,120) like '%newtime%' order by stime desc";
改成
sql1="select id,title,what,how,swhen,swhere,demand,Number,Price,about from [plan] where convert(varchar(10),stime,120) like '%"+ newtime + "%' order by stime desc";
应该可以了。