asp数据库查询问题

来源:百度知道 编辑:UC知道 时间:2024/05/14 07:38:37
在数据库中查询出字段a,想用a做为查询条件怎么写?
sql="select * from [aa]"
if a="4" then
sql=sql & "where a=<%rs=("a")%>"
end if
不知道这么写对不对??

sql1="select * from bb" '这个语句查出a字段?
rs.open sql1,conn,1,1
sql="select * from [aa]"

if not(rs.bof and rs.eof) then
if rs("a")=4 then
sql=sql & "where a='" & a & "'"
end if
end if

兄台,你的不对,表不应该有中括号吧
你应该这样写

sql="select * from aa"
if a="4" then
sql="select * from aa where a='" & a & "'"
end if
这样是不是更爽呢呵呵

sql="select * from [aa] "
if a="4" then
sql=sql& "where a='"&a&"'"
end if

sql="select * from [aa]"
if a="4" then
sql=sql & "where a='" & a & "'"
end if

rs?有么?