怎样把以下两段代码合在一页并正确读取数据库数据????
tnt2 2001-12-05 10:53:32 这两段代码在各自页面可以正常读取数据库数据,现怎样把他们放在一个页面正常读取数据库数据,互不冲突??谢谢!
代码(1)
<% @language=vbscript %>
<%
option explicit
response.expires=0
%>
<!--#include file="../asp/adovbs.inc"-->
<%
dim o_conn,o_info
dim info_4(5,4),i
set o_conn=server.createobject("adodb.connection")
o_conn.open st_connection
set o_info=server.createobject("adodb.recordset")
set o_info.activeconnection=o_conn
o_info.open "select top 5 o_id,title,time,username from xd_info where type1=4 order by time desc"
i=1
do while not o_info.eof
if len(trim(o_info("title")))>8 then
info_4(i,1)=left(trim(o_info("title")),8) & "..."
else
info_4(i,1)=o_info("title")
end if
info_4(i,2)=formatdatetime(o_info("time"),2)
info_4(i,4)=o_info("o_id")
i=i+1
o_info.movenext
loop
o_info.close
set o_info=nothing
%>
代码(2)
<%@ LANGUAGE="VBSCRIPT" %>
<%
option explicit
response.expires=0
%>
<!--#Include File="../asp/Adovbs.Inc"-->
<%
dim o_conn,o_info,o_type1,o_user,st_info_id,st_dw,st_type1,st_id,st_img
st_info_id=request.querystring("infoid")
Set O_Conn=Server.Createobject("Adodb.Connection")
O_Conn.Open St_Connection
Set o_info=Server.Createobject("Adodb.Recordset")
Set o_info.Activeconnection=O_Conn
o_info.Open "Select * From xd_info Where o_id='" & st_info_id & "'"
if isnull(o_info("img")) or len(trim(o_info("img")))=0 then
st_img="../pic_images/image.gif"
else
st_img="../pic_images/" & o_info("img")
end if
%>