Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

ASP DataBase conection

Thread Tools
 
Search this Thread
 
Old Oct 22, 2003 | 12:24 PM
  #1  
kamikaze's Avatar
kamikaze
Thread Starter
Scooby Regular
 
Joined: Oct 2001
Posts: 283
Likes: 0
Post

I have set up my computer to run server side scripts but am unable to communicate with my access database. I have wrote the code for the ODBC connection but can never write to , update, or view database data.

Will eventually change the database to SQL or oracle but wish to use access to start with for testing the ASP code as have no experience with SQL or Oracle databases.

Im using Windows 2000 and office 2000. My server side scripts run ok, so not sure what im doing wrong.
Reply
Old Oct 22, 2003 | 12:40 PM
  #2  
chiark's Avatar
chiark
Scooby Regular
 
Joined: Jun 2000
Posts: 13,735
Likes: 0
Post

well, give us a clue as to the problem. "Not working" is rather a large area to cover.

I'm guessing you've created a database connection..
dim objdbConn
set objDBConn=Server.CreateObject("ADODB.Connection")
objDBConn.open "DSN=xxxxxxx;"

Then a recordset...
dim objrs
set objrs=Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = objDBConn
rs.open "select * from wherever..."

And that should work providing your ODBC is working properly.
Reply
Old Oct 22, 2003 | 12:50 PM
  #3  
SJ_Skyline's Avatar
SJ_Skyline
Scooby Senior
 
Joined: Apr 2002
Posts: 21,922
Likes: 2
From: Limbo
Thumbs up

.....or use a connection string:

' define variables
dim strCon
dim objDBConnect
dim objRS
dim strSQL

' define connection string
strCon = "Provider=Microsoft.Jet.OLEDB.4.0 ; Data Source=c:\database.mdb"

' define object types
set objDBConnect = Server.CreateObject("ADODB.Connection")
set objRS = Server.CreateObject("ADODB.Recordset")

' open database connection
objDBConnect.Open strCon

' define your sql query
strSQL = "SELECT * FROM tblTableName"

' open recordset
objRS.Open strSQL, objDBConnect, adOpenForwardOnly, adLockReadOnly, adcmdtext

' do your recordset processing here

objRS.Close

' and dont forget to tidy up!!
objDBConnect.close
set objRS = nothing
set objDBConnect = nothing


cool stuff on db locktypes
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Darrell@Scoobyworx
Trader Announcements
26
Jan 30, 2024 01:27 PM
Iqy7861
Insurance
5
Oct 1, 2015 07:57 PM
mega_stream
Non Scooby Related
2
Aug 9, 2001 07:51 PM
Carl Harvey
ScoobyNet General
12
Jan 25, 2001 12:36 PM
Kev
Non Scooby Related
7
Dec 3, 2000 06:34 PM




All times are GMT +1. The time now is 08:48 AM.