Home
>
ASP > Database Connections in ASP
Database Connections in ASP
1.1) MSSQL ( Microsoft SQL Server ) Connection in ASP
Sturcture 1.1:
1 2 3 4
| <%
Set ConnectionName=Server.CreateObject("Adodb.Connection")
ConnectionName.Open "driver={SQL Server};server=MyHost;uid=MyLogin;pwd=MyPassword;database=MyDatabaseName"
%> |
You can determine the server, uid, pwd and database variables as you need.
Example 1.1:
1 2 3 4
| <%
Set MyConn=Server.CreateObject("Adodb.Connection")
MyConn.Open "driver={SQL Server};server=127.0.0.1;uid=memisologin;pwd=memiso;database=memisodb"
%> |
1.2) MDB ( Microsoft Access Database ) Connection in ASP
Sturcture 1.2:
1 2 3 4
| <%
Set ConnectionName=Server.CreateObject("ADODB.Connection")
ConnectionName.Open "PROVIDER=MSDASQL; DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath(DatabasePath)
%> |
You can determine the DatabasePath variable as you need.
Example 1.2:
1 2 3 4
| <%
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open "PROVIDER=MSDASQL; DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("db/memisodb.mdb")
%> |
1.3) MYSQL Connection in ASP
Sturcture 1.3:
1 2 3 4
| <%
Set ConnectionName=Server.CreateObject("ADODB.Connection")
ConnectionName.Open " DRIVER={MySQL ODBC 3.51 Driver}; server=MyHost; uid=MyLogin;password=MyPassword; database=MyDatabaseName; option=3; "
%> |
You can determine the
server,
uid,
password and
database variables as you need.
Example 1.3:
1 2 3 4
| <%
Set MyConn=Server.CreateObject("Adodb.Connection")
MyConn.Open " DRIVER={MySQL ODBC 3.51 Driver}; server=127.0.0.1; uid=memisologin;password=123456; database=memisodb; option=3;
%> |
Recently Typed