我有一个连接表(details),连接两个数据表,sql语句是:SELECT sjxx.*, baoxiu.*
FROM baoxiu INNER JOIN sjxx ON baoxiu.baoxiu_user = sjxx.username;我的程序中的代码是:
Dim baoxiu_id,rs
baoxiu_id=cint(request("baoxiu_id")) set rs=server.createobject("adodb.recordset")
sql="select * from details where baoxiu_id=" & baoxiu_id
rs.open sql,conn,3,2
if rs.eof and rs.bof then
rs.close
set rs=nothing
'Response.Write "<script>alert('"& baoxiu_id &"');window.location.href='index.asp';</script>"
Response.Write "<script>alert('该用户未登记计算机基本信息,请补充登记');window.location.href='index.asp';</script>"
Response.end end if如果有匹配的数据,就能显示全部的数据;如果没有匹配的数据,就有了上面的语句,程序中止了,就不能继续,我现在想在没有匹配数据的情况下,也能够显示baoxiu表中的所有数据,而sjxx表中的数据就不显示,或者赋为空值。不知道怎么实现,请大家帮帮忙,明天就要交作业了,谢谢!!!
FROM baoxiu INNER JOIN sjxx ON baoxiu.baoxiu_user = sjxx.username;我的程序中的代码是:
Dim baoxiu_id,rs
baoxiu_id=cint(request("baoxiu_id")) set rs=server.createobject("adodb.recordset")
sql="select * from details where baoxiu_id=" & baoxiu_id
rs.open sql,conn,3,2
if rs.eof and rs.bof then
rs.close
set rs=nothing
'Response.Write "<script>alert('"& baoxiu_id &"');window.location.href='index.asp';</script>"
Response.Write "<script>alert('该用户未登记计算机基本信息,请补充登记');window.location.href='index.asp';</script>"
Response.end end if如果有匹配的数据,就能显示全部的数据;如果没有匹配的数据,就有了上面的语句,程序中止了,就不能继续,我现在想在没有匹配数据的情况下,也能够显示baoxiu表中的所有数据,而sjxx表中的数据就不显示,或者赋为空值。不知道怎么实现,请大家帮帮忙,明天就要交作业了,谢谢!!!
baoxiu_id=cint(request("baoxiu_id")) set rs=server.createobject("adodb.recordset")
sql="select * from details where baoxiu_id=" & baoxiu_id
rs.open sql,conn,3,2
if rs.eof and rs.bof then
rs.close response.write "第一次查询没有记过"
dim xsql,
xsql="select * from baoxiu"
rs.open xsql,conn,1,1 'conn为打开数据库对象
if rs.bof and rs.eof then
response.write "表BAOXIU没有数据"
else
do while not rs.eof
'显示数据操作....
rs.movenext
loop
end if
rs.close
set rs=nothingResponse.end end if