ADO/MySQL连接的最佳方式是什么
这是我的情况.我正在建立一个可供许多不同客户使用的网站.每个客户都有自己的MySql数据库,该数据库将存储他们的信息. 他们的初始身份验证将使用ASP.net角色进行 和存储在SQL 2005服务器中的用户.一旦通过身份验证,该网站就会在其MySQL数据库中查找客户的连接字符串.我可以进行身份验证和连接字符串检索,但不确定如何 将连接字符串与ADO.net连接器配合使用,以使所有这些组合在一起.这是Godaddy网站上的一个示例,但是如何为用户插入从SQL 2005服务器检索到的连接字符串....
Here is my situation. I am building a website that many different customers will use. Each customer will have his/her own MySql Database which will house their information. Their initial authentication will take place using ASP.net roles and users stored in a SQL 2005 server. Once authenticated the website will look for the customers connection string to his/her MySQL database. I have the authentication and connection string retrieval working but I am not sure how to use the connection string with the ADO.net connector to make this all come together. Here is an example from the godaddy website, but how can I insert the connection string I have retrieved from the SQL 2005 server for the user....
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) & "<br>"
oRS.movenext
wend
oRS.close
end if
Set oRs = nothing
Set oConn = nothing
Any suggestions would be appreciated. Thank you.
这是一个C#论坛,看起来像VB6代码.
This is a C# forum and this looks like VB6 code.
您打算为此任务使用哪种语言?
What language are you planning to use for this task?