DSN-Less Connection to an Access or SQL Server Database Demo (ASP)

Category:
ASP, HTML and XML
Type:
Snippets
Difficulty:
Beginning
Author:
Intelligent Solutions Inc.

Version Compatibility: ASP

More information:
A commonly asked question is how to connect to a database in ASP without using a DSN or ODBC. This example shows you how to construct the connection string to do this using the native OLE DB providers for SQL Server and Access, which are faster than their ODBC counterparts. It also shows you how to create command and recordset objects off the connection. The comments explain what you need to change when porting this code to your own application.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: