注册 登录
编程论坛 ASP技术论坛

能 同时用几个数据集读数据库么

lzxm160 发布于 2008-10-04 09:46, 824 次点击
Dim MM_conn_STRING
MM_conn_STRING = "Driver=Microsoft Access Driver (*.mdb);DBQ="&server.mappath("news.mdb")'数据库连接字符串
%>

<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "0"
If (Request("MM_EmptyValue") <> "") Then
  Recordset1__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM type WHERE typeid > " + Replace(Recordset1__MMColParam, "'", "''") + " ORDER BY typeid DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()


<!-- #include file="inc_connect.asp"-->

    function getp(ps)
    sql="Select count(id) from Candidate where ps>"&ps
    Set ts=cnn.execute(sql)
    getp=ts(0)+1
    end function
    '============================================建立数据集rs_vote  链接字符串
    Set rs_vote = Server.CreateObject("ADODB.Recordset")
    rsstring_vote = "SELECT id,name,rq,college,photo,ps from Candidate where ps in (SELECT max(ps) from Candidate Group by t_group)"

    rs_vote.Open rsstring_vote,cnn,3,4 此行出错
    if not rs_vote.eof then
    %>

报错
ADODB.Recordset 错误 '800a0e7d'

连接无法用于执行此操作。在此上下文中它可能已被关闭或无效。
2 回复
#2
duanchangren22008-10-04 09:54
#3
孤独冷雨2008-10-04 14:41
rs_vote.Open rsstring_vote,cnn,3,4 改成
rs_vote.Open rsstring_vote,cnn,1,3 试试!
1