5 ways to connect to a database in a database ASP <BR> (01-3-30 199) <br><br><br>from:chinaasp.com by Caoli <BR>< Br><br> first-This method is used in Access at most <br><br>strconn = "Driver=microsoft access DRIVER (*.mdb);D bq=" & Server.MapPath ("Aspfree.mdb") <br><br>set conn = Server.CreateObject ("adodb.connection") <BR>< Br>conn.open strconn <BR><BR> Second-this method is used in SQL Server for more <br><br>strconn = "Driver={sql <br >server};D Escription=sqldemo; server=127.0.0.1; Uid=loginid; Pwd=password;database=database_name <br><br>set conn = Server.CreateObject ("adodb.connection") <BR ><br>conn.open strconn <BR><BR> The Third kind of <br><br>strconn= "driver={ Microsoftaccessdriver (*.mdb)}; "&_ <BR><BR>" dbq=f:\inetpub\wwwroot\somedir\db1.mdb;defaultdir=f : \inetpub\wwwroot\somedir;uid=loginid; "&_ <BR><BR>" pwd=password;driverid=25;fil=msaccess; "Set conn = Server.CreateObject ("Adodb.connectIon ") <br><br>conn.open strconn <BR><BR> Fourth application of system data source <br><br>the following uses a Data Source Name: <br><br>set conn = Server.CreateObject ("adodb.connection") <BR><BR> Conn.Open "Example" <BR><BR> fifth use ODBC data source, provided that you must set up the data source <br><br>set RS in the Control Panel ODBC Server.CreateObject ("Adodb.recordset") <br><br>rs.open "Tblname", "DSNname", 3, 3 <BR> <br> <CENTER></CENTER>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service