ASP记录集查询判断问题,请教高手

2025-05-14 02:00:27
推荐回答(1个)
回答1:

<%
 Dim DB, Conn, ConnStr
 DB = "数据库路径名称"
 ConnStr  = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath( DB )
 Set Conn = server.createobject("ADODB.connection")  
 Conn.open ConnStr
 
 if err then
   Response.write "数据库连接失败,请检查数据库路径"  
   Response.end() 
 end if

 Dim out_trade_no
     out_trade_no = Request.form("out_trade_no")
     if out_trade_no = "" then
       Response.write "订单号不能为空"
       Response.end()
     end if

Dim Rs
    Set Rs =  Server.CreateObject ("ADODB.Command")
        Rs.open "select * from ce_cz_biao where ce_cz_ddbh = " & out_trade_no, Conn, 1, 1
        if not ( Rs.eof and Rs.bof ) then
          Response.write "存在"
            else
          Response.write "不存在"
         end if
      Rs.close
   Set Rs = nothing

 Conn.close
Set Conn = nothing
%>

 代码纯手工打的,未借助任何工具!

请测试!