Tips Station Asp.net Article Seo Articles
Tutorials Code Samples
›  Home
›  Mission
›  About us
›  Contact Us
›  Feedback
›  Terms & Condition
Asp Articles
IT Solutions
 
› ASP.NET

› Programming Tips

› Ajax

› Asp

› ADO.NET

› Databases

› SEO

› CSS And Designing

› Php

 
Most Viewed Articles
 
› Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

› Change theme dynamically without page refresh in ASP.NET

› Simple ASP Image Resize Function

› Install AJAX On Machines Running Visual Studio 2005

› ASP.Net Interview Questions And Their Answers

› Creating Pretty Popups Using AJAX

› Encode Url using ASP

› SQL Server Performance Counters

› .NET Data Access Performance Comparison

› UpdatePanel control in Asp.net Ajax

more...
 
 
Home> Asp
 
How to connect to a database via a DSN-Less connection - ASP
 

Here is what the code looks like:

Dim oConn, sConnString
Set oConn = Server.CreateObject("ADODB.Connection")
sConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & Server.MapPath("\MemberName\db\dbname.mdb") & ";"
oConn.Open(sConnString)

At this point you can define a SQL statement and execute it:

sql = "select * from myTable"
Set RS = Conn.Execute(sql)

The components of the DSN-Less connection explained:

First we instantiate the Connection Object:

Set Conn = Server.CreateObject("ADODB.Connection")

Next we define the actual connection string:

sConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & Server.MapPath("\MemberName\db\dbname.mdb") & ";"

Make sure the above line of code is all on one line in your code, don't wrap it. In this statement we are telling ADO (Active Data Objects) that we want to use the MS Access driver and where our database is physically located.

Conn.Open(MyConnStr)

This is the line of code that actually opens the connection to the database. After you have done this you are ready to execute a SQL statement.

 
 
Vrp Technologies
 
Serversea Hosting
 
 
Latest Articles
 
› Sending SMS With PHP

› MySQL Join Tutorial

› Make An RSS Feed Using PHP

› Intro To Object: Option Variables

› Design An Online Chat Room With PHP And MySQL

› Create Tell A Friend Script With HTML & PHP

› Benchmark And Optimize PHP Script Speed

› What Kind of DBA Are You?

› SQL Server Performance Counters

› SQL Server Performance Tips

more...
 
Random Articles
 
› List of all selected items in a CheckBoxList - Asp.net

› Read and display a text file in Asp.net

› Intro To Object: Option Variables

› How to export a GridView to Excel - Asp.net

› Make An RSS Feed Using PHP

› Get To The Top 10 Website Search Engine Rank In 5 Easy Steps

› Select Specific Value WithIn Drop Down List Or Radio Button List

› Dynamically Generating Thumbnail Images in ASP.NET

› Generating Ms Excel file from GridView with ASP.NET

› Install AJAX On Machines Running Visual Studio 2005

more...
 
Home Mission About us Contact us Feedback Terms Conditions
2008 © Copyright TipsStation. All rights reserved.