Print Page | Close Window

Connecting to database

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=9576
Printed Date: 01 April 2026 at 1:00am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Connecting to database
Posted By: jimidy
Subject: Connecting to database
Date Posted: 05 February 2004 at 3:22pm

I'm trying to connect to a database...

I am using a page called connect.asp  which has the following code..

<%
'Option Explicit
Dim myConn, myDb, rs, rs2, sql
Set myconn=server.createobject("ADODB.connection")
mydb = "Driver={Microsoft Access Driver (*.mdb)};DBQ=srp.mdb"
myconn.open mydb
set rs = server.createobject("ADODB.Recordset")
set rs2 = server.createobject("ADODB.Recordset")
%>

The DB is in the same folder as the page, is this right? or is there another code I can use..?

many thanks in advance.. 



-------------
www.srp.me.uk



Replies:
Posted By: MorningZ
Date Posted: 05 February 2004 at 4:05pm

you'll have to fill people in on more info

do you get an error?
if you do, what error?

Some pages on this site to read:
http://www.webwiz.net/asp/faq/access_database_faq.asp - http://www.webwiz.net/asp/faq/access_database_faq.asp
http://www.webwiz.net/asp/tutorials/connecting_to_a_database.asp - http://www.webwiz.net/asp/tutorials/connecting_to_a_dat abase.asp



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: jimidy
Date Posted: 05 February 2004 at 4:10pm

sweet i sorted it with the Guest book tutorial..

 

<%
'Option Explicit
Dim myConn, myDb, rs, rs2, sql
Set myconn=server.createobject("ADODB.connection")
mydb = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("srp.mdb")
myconn.open mydb
set rs = server.createobject("ADODB.Recordset")
set rs2 = server.createobject("ADODB.Recordset")
'This page enables us to specify the whereabouts of the database by simply writing one line on each page.  It means that we can change the location of the database easily by changing its address on this page only.
%>

 

cheerz..



-------------
www.srp.me.uk



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net