Santry Technology Solutions, Content Management, DotNetNuke, SharePoint Consulting
Register | Login
Wednesday, January 07, 2009

Sections
  
About Us
  
Partners
Downloads
  
 WWWCoder.com Resource Directory

DSN-less Applications
11/28/1999 12:00:00 AM

No need to set up a DSN on the Web server. This tutorial will show you how. It even includes a Javascript app that will take your input and create the DSN setup for inserting into your ASP script.

So you don't want to create a DSN on the machine that your web app is installed.
What benefits can you get from this? Say you have a website on a Virtual Provider
and you just created that new database app and you want to test. Well you have to
email your VP's support to create the DSN and make sure you spell everything correctly
so they don't create something that you don't want. Another example is connecting
to a database dynamically and opening it in your code (I'll be going over this
in a future function in detail
).


First the absolute minimum is to tell ADO where your database is located and
what driver to use. Being that the database is located on the machine we're talking
a file based database, hence we'll use Access.


In your Global.asa or any file for that matter, just build the following string
and assign it to a variable.



DBConnConnectionString = "DBQ=c:\MyDB.mdb;Driver={Microsoft Access Driver(*.mdb)};"


'once your string is built then use it to connect and open the database.



Set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open DBConnConnectionString



You can pass all the parameters you specify in ODBC manager.


DefaultDir=c:\;
DriverId=25;
FIL=MS Access;
ImplicitCommitSync=Yes;
MaxBufferSize=512;
MaxScanRows=8;
PageTimeout=5;
SafeTransactions=0;
Threads=3;
UID=admin;
UserCommitSync=Yes;



Use this utility to generate a DSN for your ASP script just enter the path to
your Access database located on your web server and then click on the Generate button
to create your DSN.


Enter full path and name of Access database:

     


Cut & Paste into your ASP code:

       


 

               








Page Options:
format for printing  Format for Printer
email article  Email Page
add to your favorites   Add to Favorites
How would you rate the quality of this content?
Poor - - Excellent
Comments?
Overall Rating:
Comments Left:
Left on 3/1/2006 2:45:35 PM by Anonymous
Comments: This code does not appear to work.
  

 Latest Articles
  

 Latest News
  

 

Spotlight
Syndication

 


 


Digg This
 


DotNetNuke Platinum Benefactor

  
 

 Terms Of Use | Privacy Statement
 Copyright 2008 - Santry Technology Solutions, Box 172, Girard, PA 16417, (814) 774-0970