DSN-less Connection String syntax!

Contributed by
Rating: 5 stars5 stars5 stars5 stars5 stars / 10
September 01, 1999
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement
I'm sick of typing mine so I would put this page of the different ones I use!  This page just provides some different ways of connecting to a database.

 

Type One - This is the one I use the most w/Access! DSN-Less Connection example #1

strconn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("aspfree.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn

Type Two - This is the one I use the most w/MS-Sql 7! DSN-Less Connection example #2

strconn = "Driver={SQL Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;PWD=Password; DATABASE=Database_Name
set conn = server.createobject("adodb.connection")
conn.open strconn

Type Three - DSN-Less Connection example #2

strconn="Driver={MicrosoftAccessDriver(*.mdb)};DBQ=F:\Inetpub\wwwroot\somedir\db1.mdb;DefaultDir=

f:\Inetpub\wwwroot\somedir;uid=LoginID;pwd=Password;DriverId=25;FIL=MSAccess;" set conn = server.createobject("adodb.connection")
conn.open strconn

Type Four - using a System Data Source Name

The following uses a Data Source Name:

set conn = server.createobject("adodb.connection")
conn.open "Example"
'This is created in the Control Panel using the 32 bit ODBC Driver. If you don't know how to setup here is a perfect example on ActiveServerPages.com

Type Five - Not using a connection and just using a ODBC DSN. Note:You have to setup an odbc Entry in the Control Panel

set rs = server.createobject("adodb.recordset")
rs.open "tblname", "DSNName", 3, 3

Dsn-less code from our Microsoft Friends!

http://www.microsoft.com/data/ado/adords15/docs/adoprox1_7.htm

(click here to find how to create System and File DSN's!

blog comments powered by Disqus
DATABASE CODE ARTICLES

- Deployment of the MobiLink Synchronization M...
- MobiLink Synchronization Wizard in SQL Anywh...
- Finding Matching Records in Data Access Pages
- Using the AccessDataSource Control in VS 2005
- A Closer Look at ADO.NET: The Command Object
- A Closer Look at ADO.NET: The Connection Obj...
- Using ADO to Communicate with the Database, ...
- Code Snippets: Counting Records
- Constraints In Microsoft SQL Server 2000
- Multilingual entries into a DB and to be dis...
- Two combos, one textbox example
- ADO Recordset Paging
- SQL Server Database Creator - .NET Version
- Getting A List of Tables From SQL Server
- Discussion & Listserv Module by Mike Eck...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials