ASP 怎么拼接sql语句?急,在线等!!我的代码如下,老是报错
typeid=request.form("selectType")place=request.Form("selectPlace")page=clng(request("...
typeid=request.form("selectType")
place = request.Form("selectPlace")
page=clng(request("page"))
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select j.id,content,typeid,typename,title,peopleNum,workplace,addtime from tb_job j left join tb_job_type t on j.typeid=t.id where "
if place<>"" then
a = " and workplace = "&place&" "
sql = a & " " & sql
end if
if typeid>0 then
b=" and typeid="&typeid&" "
sql = a & " " & sql
end if
c = " order by j.id desc "
sql = a & " " & sql 展开
place = request.Form("selectPlace")
page=clng(request("page"))
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select j.id,content,typeid,typename,title,peopleNum,workplace,addtime from tb_job j left join tb_job_type t on j.typeid=t.id where "
if place<>"" then
a = " and workplace = "&place&" "
sql = a & " " & sql
end if
if typeid>0 then
b=" and typeid="&typeid&" "
sql = a & " " & sql
end if
c = " order by j.id desc "
sql = a & " " & sql 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询