Sample Code : Connecting to a MySQL database with ASP using a DSN-less connection

 

Here is the connection string, you can use to connect to a MySQL database with ASP :

<%

Set Conn=Server.CreateObject("ADODB.Connection")

Conn.open("DRIVER={MySQL ODBC 3.51 Driver};SERVER=sql.yourdomain.com;DATABASE=dbname;UID=dbuser;PWD=dbpassword; OPTION=3")

%>

Replace yourdomain.com with the name of your domain, dbname with your database name, dbuser with your database username and dbpassword with your database password.

Was this answer helpful?

 Print this Article

Also Read

Sample Code : Query an Access database with ASP using a DSN-less connection

<% Dim cnnSimple  ' ADO connectionDim rstSimple  ' ADO recordsetSet cnnSimple =...

How to enable ASP.NET SQL Server Session on your web application

SQLServer mode stores session state in a SQL Server database. Using this mode ensures that...

Which version of Microsoft .NET Framework do you support?

We support all versions of Microsoft .NET Framework including v1.1, v2 and v3.5 side-by-side on...

How to configure your website for using Ajax (for Windows 2008 Hosting Plans)

Note:  If you want to use ASP.Net "Integrated PipeLine" version (under any circumstance) you...

There is three types of ASP.Net sessions :

1)Inprocess session   (it's stored by default in web.cofig File and use for same...