[提问]
===晕死哦,GODADDY上ASP.NET + MYSQL到底要怎样连接?===
|
|
折腾了一整天,试了三种方法:
1.用MySQL Net 6.3.5连接提示如下:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
2.用ODBC方式连接提示
Access denied for user: '***@******' (Using password: YES),向上帝保证我的用户名和密码也是正确的,在本地报这个错还好解决,远程主机上如何解决?
3.用OLEDB方式提示:
The 'MySQL Provider' provider is not registered on the local machine.
在本地可以连接成功,上传到空间就报这个错.
有谁能帮帮我啊 |
|
|
|
|
|
|
|
|
|
|
add.c
发表于 2011-1-13 10:53:43
|
显示全部楼层
ASP/ADO连接示例代码- <%
- Dim oConn, oRs
- Dim qry, connectstr
- Dim db_name, db_username, db_userpassword
- Dim db_server
- db_server = "mysql.secureserver.net"
- db_name = "your_dbusername"
- db_username = "your_dbusername"
- db_userpassword = "your_dbpassword"
- fieldname = "your_field"
- tablename = "your_table"
- connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
- Set oConn = Server.CreateObject("ADODB.Connection")
- oConn.Open connectstr
- qry = "SELECT * FROM " & tablename
- Set oRS = oConn.Execute(qry)
- if not oRS.EOF then
- while not oRS.EOF
- response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "
- "
- oRS.movenext
- wend
- oRS.close
- end if
- Set oRs = nothing
- Set oConn = nothing
- %>
复制代码 |
|
|
|
|
|
|
|
|
|
|
benzhu
发表于 2011-1-13 11:08:03
|
显示全部楼层
|
上面是ASP的代码,不是ASP.NET,我代码肯定是没错的,在本地都能运行正常 |
|
|
|
|
|
|
|
|
|
|
getst
发表于 2011-1-13 11:28:30
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
benzhu
发表于 2011-1-13 11:52:23
|
显示全部楼层
|
win主机哈,以前用的SQLSERVER2005的库,但SQLSERVER库限制200M |
|
|
|
|
|
|
|
|