Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP访问MySQL迁移_Mysql_Asp Classic - Fatal编程技术网

ASP访问MySQL迁移

ASP访问MySQL迁移,mysql,asp-classic,Mysql,Asp Classic,我有一个asp内部网系统,我需要将Access DB后端更改为MySQL,Access DB只是在与sql表类似的结构中使用。我创建了具有相同结构和命名约定的sql表 ASP Classic应用程序有一个文件夹,其中包含连接到每个数据库的连接,有8个Access DB,它们现在作为表合并到1个MySQL数据库中 我在浏览器中显示错误消息时遇到问题,即使将错误页面设置为在IIS7中远程显示,也会出现内部错误 旧连接: <% Dim MM_Emp

我有一个asp内部网系统,我需要将Access DB后端更改为MySQL,Access DB只是在与sql表类似的结构中使用。我创建了具有相同结构和命名约定的sql表

ASP Classic应用程序有一个文件夹,其中包含连接到每个数据库的连接,有8个Access DB,它们现在作为表合并到1个MySQL数据库中

我在浏览器中显示错误消息时遇到问题,即使将错误页面设置为在IIS7中远程显示,也会出现内部错误

旧连接:

            <%
            Dim MM_Employee_STRING
            MM_Employee_STRING = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("/employee/DB/employee.mdb")
            %>
            <%
            Dim MM_Employee_STRING
            MM_Employee_STRING = "DRIVER={MySQL ODBC 5.2};SERVER=localhost;UID=root;PWD=password;DATABASE=db")
            %>

新连接:

            <%
            Dim MM_Employee_STRING
            MM_Employee_STRING = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("/employee/DB/employee.mdb")
            %>
            <%
            Dim MM_Employee_STRING
            MM_Employee_STRING = "DRIVER={MySQL ODBC 5.2};SERVER=localhost;UID=root;PWD=password;DATABASE=db")
            %>

登录Asp代码:

            MM_LoginAction = Request.ServerVariables("URL")
            If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
            MM_valUsername=CStr(Request.Form("UserName"))
            If MM_valUsername <> "" Then
              MM_fldUserAuthorization="securityLevel"
              MM_fldUserRaisedID="RaisedNameID"
              MM_redirectLoginSuccess="index.asp"
              MM_redirectLoginFailed="error.asp"
              MM_flag="ADODB.Recordset"
              set MM_rsUser = Server.CreateObject(MM_flag)
              MM_rsUser.ActiveConnection = MM_Employee_STRING
              MM_rsUser.Source = "SELECT LoginUsername, LoginPassword, ID FROM employee_detail"
              If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization & "," & MM_fldUserRaisedID
              MM_rsUser.Source = MM_rsUser.Source & " FROM employee_detail WHERE LoginUsername='" & Replace(MM_valUsername,"'","''") &"' AND LoginPassword='" & Replace(Request.Form("Password"),"'","''") & "'"
              MM_rsUser.CursorType = 0
              MM_rsUser.CursorLocation = 2
              MM_rsUser.LockType = 3
              MM_rsUser.Open
              If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then 
                ' username and password match - this is a valid user
                Session("MM_Username") = MM_valUsername
                If (MM_fldUserAuthorization <> "") Then
                  Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
                  Session("MM_UserID") = MM_rsUser.Fields.Item("ID").Value
                  Session("MM_RaisedUserID") = MM_rsUser.Fields.Item("RaisedNameID").Value
                Else
                  Session("MM_UserAuthorization") = ""
                End If
                if CStr(Request.QueryString("accessdenied")) <> "" And false Then
                  MM_redirectLoginSuccess = Request.QueryString("accessdenied")
                End If
                MM_rsUser.Close
                Response.Redirect(MM_redirectLoginSuccess)
              End If
              MM_rsUser.Close
              Response.Redirect(MM_redirectLoginFailed)
            End If
MM\u LoginAction=Request.ServerVariables(“URL”)
如果Request.QueryString“”则MM_LoginAction=MM_LoginAction+“?”+Server.HTMLEncode(Request.QueryString)
MM_ValuerName=CStr(请求表(“用户名”))
如果MM_ValuerName为“”,则
MM_fldUserAuthorization=“securityLevel”
MM_fldUserRaisedID=“RaisedNameID”
MM_redirectLoginsAccess=“index.asp”
MM_redirectLoginFailed=“error.asp”
MM_flag=“ADODB.Recordset”
设置MM_rsUser=Server.CreateObject(MM_标志)
MM_rsUser.ActiveConnection=MM_Employee_字符串
MM\u rsUser.Source=“从员工详细信息中选择LoginUsername、LoginPassword、ID”
如果MM_fldUserAuthorization“”,则MM_rsUser.Source=MM_rsUser.Source&“,”MM_fldUserAuthorization&“,”MM_flduserarisedid
MM_rsUser.Source=MM_rsUser.Source&“来自员工详细信息,其中LoginUsername=”&Replace(MM_valuesername,“,”)&“和LoginPassword=”&Replace(Request.Form(“密码”),“,”,“,”)&”
mmrsuser.CursorType=0
MM_rsUser.CursorLocation=2
MM_rsUser.LockType=3
打开
如果不是MM_rsUser.EOF或不是MM_rsUser.BOF,则
'用户名和密码匹配-这是一个有效的用户
会话(“MM_用户名”)=MM_ValuerName
如果(MM_fldUserAuthorization“”),则
会话(“MM_UserAuthorization”)=CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization.Value)
会话(“MM_UserID”)=MM_rsUser.Fields.Item(“ID”).Value
会话(“MM_RaisedUserID”)=MM_rsUser.Fields.Item(“RaisedNameID”).Value
其他的
会话(“MM_用户授权”)=“”
如果结束
如果CStr(Request.QueryString(“accessdenied”))为“”且为false,则
MM_RedirectLoginsAccess=Request.QueryString(“拒绝访问”)
如果结束
关闭
Response.Redirect(MM_RedirectLoginsAccess)
如果结束
关闭
Response.Redirect(MM_RedirectLogin失败)
如果结束
就ASP而言,我从未接触过它,我即将把它全部转换成ASP.Net并重写它,但我想知道我是否错过了一些明显的东西


谢谢

没有错误消息,我看到两个潜在问题:

首先,
ID
可能是MySQL中的一个保留字,也是一两个错误的原因。详细的错误消息将指示这是否是问题所在


其次,您可能会得到一个包含两个
FROM
子句的SQL语句<代码>响应。写入SQL并检查发送到服务器的语句。编辑您的问题以将其包括在内。

您是否验证是否已将MySQL连接器与MySQL数据库一起安装,以便ASP应用程序可以连接到MySQL数据库。除了将IIS设置为将错误消息发送到浏览器外,您还需要关闭“友好的错误消息”以查看详细的错误信息。有了实际的错误信息,您将有更好的机会获得帮助。这是一个关于如何配置错误消息的好指南,这是一个关于MyODBC连接字符串的指南。谢谢,打开了错误,修复了预期的结束语句,但得到了以下信息:错误“80004005”/login.asp,第15行第15行是:MM_rsUser.ActiveConnection=MM_Employee_字符串