ASP同时读取两个数据表怎样写
sql="selecta.city,b.twebtitle,b.twebkeywords,b.twebdescriptionfromchina_cityasa,china...
sql="select a.city,b.twebtitle,b.twebkeywords,b.twebdescription from china_city as a,china_type as b where a.id="&city_oneid&" and a.twoid="&city_twoid&" and a.threeid="&city_threeid&" and b.id="&type_oneid&" and b.twoid="&type_twoid&" and b.threeid="&type_threeid&""
set rs=server.createObject("ADODB.recordset")
rs.open sql,conn,1,1
if rs.eof then
rs.close:set rs=nothing
conn.close:set conn=nothing
response.Write("错误参数")
response.end
else
webtitle1=rs("city") ("twebtitle")&" "
webdescription1=rs("twebdescription")&" "
webkeywords1=rs("twebkeywords")&("city")&" "
这样写只能显示前面的,应该怎样写才能显示city 与twebkeywords呢?
if type_oneid<>0 and city_oneid<>0 then
sql="select a.city,b.twebtitle,b.twebkeywords,b.twebdescription from china_city as a,china_type as b where a.id="&city_oneid&" and a.twoid="&city_twoid&" and a.threeid="&city_threeid&" and b.id="&type_oneid&" and b.twoid="&type_twoid&" and b.threeid="&type_threeid&""
set rs=server.createObject("ADODB.recordset")
rs.open sql,conn,1,1
if rs.eof then
rs.close:set rs=nothing
conn.close:set conn=nothing
response.Write("错误参数")
response.end
else
webtitle1=rs("city")&( "twebtitle")&" "
为什么只能读取city数据,怎样才能同时读取city twebtitle数据呢? 展开
set rs=server.createObject("ADODB.recordset")
rs.open sql,conn,1,1
if rs.eof then
rs.close:set rs=nothing
conn.close:set conn=nothing
response.Write("错误参数")
response.end
else
webtitle1=rs("city") ("twebtitle")&" "
webdescription1=rs("twebdescription")&" "
webkeywords1=rs("twebkeywords")&("city")&" "
这样写只能显示前面的,应该怎样写才能显示city 与twebkeywords呢?
if type_oneid<>0 and city_oneid<>0 then
sql="select a.city,b.twebtitle,b.twebkeywords,b.twebdescription from china_city as a,china_type as b where a.id="&city_oneid&" and a.twoid="&city_twoid&" and a.threeid="&city_threeid&" and b.id="&type_oneid&" and b.twoid="&type_twoid&" and b.threeid="&type_threeid&""
set rs=server.createObject("ADODB.recordset")
rs.open sql,conn,1,1
if rs.eof then
rs.close:set rs=nothing
conn.close:set conn=nothing
response.Write("错误参数")
response.end
else
webtitle1=rs("city")&( "twebtitle")&" "
为什么只能读取city数据,怎样才能同时读取city twebtitle数据呢? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询