ACCUWEBHOSTING.COM
Live Chat
Sales / Billing / Support
Support
FAQ, Help Desk
Share / Save
Bookmark
Author

This original article is the property of AccuWebHosting.Com (http://www.accuwebhosting.com/). AccuWebHosting.com has been providing world class Windows VPS Hosting services to the global community for nearly the past decade. Priding ourselves in providing innovative technology coupled with top notch customer service, this credo has allowed not only us, but our customers to experience success and substantial growth. Find Top Private Cloud Hosting, VPS Windows and CPanel VPS Hosting plans at affordable rates only at AccuWebHosting.Com. Unleash the power of Cheap Windows VPS solution by AccuWebHosting.Com.

 

Connection String Used In ASP And ASP.NET Using DSN

As we know that there are two ways to connect with database one is using DSN and second one is without DSN. Today I will provide you guideline how to establish connection with MS ACCESS database using DSN. To establish connection with database using DSN first of all you have to create DSN of database which you want to use in your application, like DSN for ACCESS, SQL, etc

 

For giving you perfect idea on how to work with DSN I am giving you full source code which you can use in your application but be sure that code is written for ASP.

 

To start coding using asp first of all you have to declare Scriplet tag which is the first line of ASP coding which you can see below

 

 

<%

set objcon=server.CreateObject("ADODB.Connection")

objcon.ConnectionTimeout=60

objcon.Open "DSN=dsnname"

Set RS2 = Server.CreateObject("Adodb.RecordSet")

rs2.ActiveConnection=objcon  

rs2.LockType=1

rs2.CursorLocation=3

rs2.CursorType =1

query="select nm from Table"

rs2.open query

                        if rs2.recordcount > 0 then

                        do while not rs2.eof

                        Variable = rs2("fieldname")

response.Write(id)      

                        rs2.movenext

                        loop                                                    

                        end if                                                   

rs2.close

‘Don’t forget to write below given lines

objcon.Close

Set objcon=Nothing

%>


(Posted By Aden on Friday, March 31, 2006)

 Read All Stories
 

© Copyright 2010 - 2020 AccuWebHosting.Com. All rights reserved. AccuWebHosting.com,
48 Bi-State Plaza #185 Old Tappan, NJ 07675, United States of America