多个网页上的单个SQL连接

时间:2011-06-10 08:38:52

标签: html sql vbscript asp-classic

如何在多个网页上使用sql连接字符串。我一直在看下面的代码,但我不知道代码如何连接到数据库。

选择案例str_Action

case str_AddLangText
    ' Complete add
    if isarray(str_temp1) and isarray(lng_ActionPermissionID) then
        for lng_Count2 = lbound(lng_ActionPermissionID) to ubound(lng_ActionPermissionID)
            if isnumeric(lng_ActionPermissionID(lng_Count2)) then
                for lng_Count = lbound(str_temp1, 2) to ubound(str_temp1, 2)
                    str_SQL = "A_PagePermission_insert"
                    obj_ADO.ClearParameters
                    obj_ADO.AddParameter "SessionID", adChar, adParamInput, len(obj_Session.str_SessionID), obj_Session.str_SessionID
                    obj_ADO.AddParameter "PermissionID", adInteger, adParamInput, 8, clng(lng_ActionPermissionID(lng_Count2))                       
                    obj_ADO.AddParameter "PageID", adInteger, adParamInput, 8, clng(str_temp1(0, lng_Count))
                    obj_ADO.Execute str_SQL, adCmdStoredProc, obj_Session.int_CommandTimeout & "<br />"
                next
            end if
        next
    else
        str_Messages = trim(obj_Content.GetContent("ErrorCode50003"))
    end if
    str_Action = obj_Session.str_FileName
case str_DeleteLangText
    'Complete delete
    if isarray(str_temp1) and isnumeric(lng_PermissionID) then
        for lng_Count = lbound(str_temp1, 2) to ubound(str_temp1, 2)
            str_SQL = "A_PagePermission_delete"
            obj_ADO.ClearParameters
            obj_ADO.AddParameter "SessionID", adChar, adParamInput, len(obj_Session.str_SessionID), obj_Session.str_SessionID
            obj_ADO.AddParameter "PermissionID", adInteger, adParamInput, 8, clng(lng_PermissionID)
            obj_ADO.AddParameter "PageID", adInteger, adParamInput, 8, str_temp1(0, lng_Count)
            obj_ADO.Execute str_SQL, adCmdStoredProc, obj_Session.int_CommandTimeout & "<br />"
        next
    else
        str_Messages = trim(obj_Content.GetContent("ErrorCode50056"))
    end if
    str_Action = obj_Session.str_FileName
case else

结束选择 str_Messages = str_Messages&amp; “
”&amp; vbcrlf&amp; str_Required

1 个答案:

答案 0 :(得分:1)

obj_ADO可能在以前的代码块中实例化。您是否检查过您的代码文件是否都包含相同的文件(通常是conn.asp,setup.asp或类似文件)?

使用obj_ADO进行“在文件中查找”搜索。你应该能够找到它的使用位置。

修改

如果您获得的结果太多,请尝试搜索Server.CreateObject("ADODB.Connection")或其他ADODB变体。