DSN-Less Connection to MySQL in ASP
To access a MySQL database in ASP you can use the following script:
Function getDBConn()
Set conDB=Server.CreateObject("ADODB.Connection") conDB.Open "Driver={MySQL ODBC 3.51 Driver};" & _ "Server=mysql.myserver.net;" & _ "Port=3306;" & _ "Option=131072;" & _ "Stmt=;" & _ "Database=mydatabase;" & _ "Uid=myname;" & _ "Pwd=mypassword" End Function
Remember to change the Server address to the address of your MySQL database; also you will need to change the Database, Uid and Pwd parameters as appropriate.
Labels: asp, mysql, source code

