如果你是想两个结果的合集,就用or,
sql="select
*
from
link
where
link_id="&trim(request("link_id"))
"
and
webName='"&trim(request("webName"))&"'"
如果是想要两个结果的交集,就用and
sql="select
*
from
link
where
link_id="&trim(request("link_id"))
"
and
webName='"&trim(request("webName"))&"'"
拼sql语句,空格和引号是关键
'定义链接set conn=Server.CreateObject("ADODB.Connection")
conn.open "provider=sqloledb.1Persist Security Info=falsedata source=数据库地址User ID=用户名pwd=用户密码Initial Catalog=数据库名字"
'定义表
Set ds=Server.CreateObject("ADODB.Recordset")
'查询语句
sql="select * from Table1"
'查询
ds.open sql,conn,1,1
'循环绑定
Do While Not ds.Eof
Response.Write "<li><span>"&ds("date")&"</span><span>"&ds("id")&"</span></li>"
ds.Movenext
Loop
'关闭对象
ds.CLose
Set ds=Nothing
conn.CLose
Set conn=Nothing
'第一处,请注意橙色语法部分sql="select * from zhang"rs.open sql,conn,1,1
If Not (rs.bof And rs.eof) Then '不为空时显示
do while not rs.eof%>'<%= rs("hao") %>',<% rs.movenext
loop
Else
response.write "没有数据"
End If
rs.close
'第二处,请注意橙色语法部分
sql="select * from zhangdan where hao='"&request("danhao")&"'"
rs.open sql,conn,1,3
If Not(rs.bof And rs.eof) Then '不为空时,表示有数据才能更新
if request("act")="mod" then
rs.update
End If
rs.close
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)