0
我有一个asp内联网系统,我需要将Access DB后端更改为MySQL,Access DB只是用于类似于sql表的结构。我创建了具有相同结构和命名约定的sql表。ASP访问MySQL迁移
ASP经典应用程序有一个连接到每个单独的数据库的连接文件夹,它们是8个访问数据库,现在合并为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")
%>
登录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
就ASP而言,我从来没有碰过它,我接近将其全部转换为ASP.Net并重写它,但想知道我是否错过了明显的东西!
感谢
您是否验证过您已安装MySQL连接器以及MySQL数据库,以便ASP应用程序可以连接到MySQL数据库。 –
除了设置IIS将错误消息发送到浏览器外,您还需要在IE中关闭“友好错误消息”以查看详细的错误信息。有了实际的错误信息,您将有更好的机会获得帮助。 – AnonJr
下面是如何配置错误消息的一个很好的指南http://www.chestysoft.com/asp-error-messages.asp – John