|
This example uses the Microsoft Access Driver and a physical path.
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=E:\www\dtruman\nuts4asp.com\dat\nuts.mdb;"
%>
This is an example of OLEDB connection using the Microsoft Jet
Engine ver 4.0 and a physical path.
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\InetPub\mdb\nuts.mdb;"
%>
This example uses the Microsoft Access Driver and a virtual path.
This would work if the database was in the same directory as the pages
working with it.
<%
Set Conn = Server.CreateObject("ADODB.Connection")
FilePath = Server.MapPath("myDB.mdb")
Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & FilePath & ";"
%>
This is an example of OLEDB connection using the Microsoft Jet
Engine ver 4.0 and a physical path.
<%
Set Conn = Server.CreateObject("ADODB.Connection")
FilePath = Server.MapPath("myDB.mdb")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath & ";"
%>
This is a DSN-LESS connection for SQL Server. Change TheServer
to the name of the server name, TheUser to your User Name, ThePassword
to your password, and TheDatabase to the name of your database.
<%
Set Conn = Server.CreateObject("ADODB.Connection")
FilePath="DRIVER={SQLServer};SERVER=TheServer;UID=TheUser;PWD=ThePassword;DATABASE=TheDatabase"
Conn.open FilePath
%>
Now that you are connected, learn to use an SQL statement to add,
delete, or edit a record using either a form or a
query string.
|