帮检查ASP读取数据库代码
<!--#includefile="conn.asp"--><%DimrsSetrs=server.CreateObject("ADODB.recordset")Dims...
<!--#include file="conn.asp"-->
<%
Dim rs
Set rs=server.CreateObject("ADODB.recordset")
Dim strSQL
strSQL="select * from T where m_id=1"
rs.Open strSQL,objConnection,3,1
a_gjl=rs("m_gjl")
response.write "&a_gjl="&a_gjl&"&"
rs.close
Set rs=Nothing
objConnection.close
Set objConnection=Nothing
response.write "&ok=1&"
%>
为什么还是加载失败?
是不是读的那里有错误? 展开
<%
Dim rs
Set rs=server.CreateObject("ADODB.recordset")
Dim strSQL
strSQL="select * from T where m_id=1"
rs.Open strSQL,objConnection,3,1
a_gjl=rs("m_gjl")
response.write "&a_gjl="&a_gjl&"&"
rs.close
Set rs=Nothing
objConnection.close
Set objConnection=Nothing
response.write "&ok=1&"
%>
为什么还是加载失败?
是不是读的那里有错误? 展开
2个回答
展开全部
<!--#include file="conn.asp"-->
<%
Dim rs
Set rs=server.CreateObject("ADODB.recordset")
Dim strSQL
strSQL="select * from T where m_id=1"
rs.Open strSQL,objConnection,3,1
if not rs.eof then
a_gjl=rs("m_gjl")
response.write "&a_gjl="&a_gjl&"&"
else
response.write("没有数据")
end if
rs.close
Set rs=Nothing
objConnection.close
Set objConnection=Nothing
response.write "&ok=1&"
%>
注意,记录集提取数据的时候,要判断一下,记录集是否是空的!!
<%
Dim rs
Set rs=server.CreateObject("ADODB.recordset")
Dim strSQL
strSQL="select * from T where m_id=1"
rs.Open strSQL,objConnection,3,1
if not rs.eof then
a_gjl=rs("m_gjl")
response.write "&a_gjl="&a_gjl&"&"
else
response.write("没有数据")
end if
rs.close
Set rs=Nothing
objConnection.close
Set objConnection=Nothing
response.write "&ok=1&"
%>
注意,记录集提取数据的时候,要判断一下,记录集是否是空的!!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询