Go Back  DVD Talk Forum > General Discussions > Tech Talk
Reload this Page >

ASP/Database problem... baffled

Tech Talk Discuss PC Hardware, Software, Internet and Other Technology

ASP/Database problem... baffled

Old 02-05-03, 09:24 PM
  #1  
Mod Emeritus
Thread Starter
 
Gallant Pig's Avatar
 
Join Date: Aug 1999
Posts: 15,325
Likes: 0
Received 0 Likes on 0 Posts
ASP/Database problem... baffled

Any reason for this to happen...? (I replaced the with [] so the code would show up)

[%

Dim oRST
Set oRST = Server.CreateObject("ADODB.Recordset")
oRST.Open "SELECT * FROM people;", "DSN=sailors"
Response.Write oRST("name")
oRST.Close
Set oRST = Nothing

%]

I have the db created in Access XP, I have the IIS5.1 server working fine, I have the db created and registered in the ODBC, the db itself looks fine. Then when I run it I get this message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/testing/testing.asp, line 13

Line 13 is the oRST.Open line.
Old 02-05-03, 09:34 PM
  #2  
X
Administrator
 
X's Avatar
 
Join Date: Oct 1987
Location: AA-
Posts: 10,763
Likes: 0
Received 4 Likes on 3 Posts
The DSN is called sailors, right? Is it a System, File, or User DSN?

Don't you explicitly have to tell it to use the Access ODBC driver in your Open statement? And maybe also specify the db's name? Or is that only for DSN-less connections?
Old 02-05-03, 10:11 PM
  #3  
Mod Emeritus
Thread Starter
 
Gallant Pig's Avatar
 
Join Date: Aug 1999
Posts: 15,325
Likes: 0
Received 0 Likes on 0 Posts
I have it on both System and User DSN (the File DSN doesn't seem to allow me to choose it in any way).

As for the code, I'm taking it from a book called Beginning ASP databases (Wrox), and as far as I know it's right. However the book is written for ASP 2.0 so maybe that's the problem. I used to have a 2000 Server box that worked with ASP+DB great, and I wrote programs that interacted with DB. However at that point I was using JavaScript, now that I'm using VBScript I can't see to access the DB (and there are about a million ways to access it using various coding methods). Maybe I'll try doing it in JavaScript to see if the VBScript code is the problem. Thanks for your help X.
Old 02-06-03, 01:06 AM
  #4  
Mod Emeritus
Thread Starter
 
Gallant Pig's Avatar
 
Join Date: Aug 1999
Posts: 15,325
Likes: 0
Received 0 Likes on 0 Posts
I tried this code with asp/javascript and here is the error message I get:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
/testing/jstesting.asp, line 23
here's part of my code (I left out some cuz that's not where the error is occuring): (replaced with [])

[%
var adoConnection = Server.CreateObject("ADODB.Connection");
var adoRecordSet;
var mySQL;
adoConnection.Open("DSN=sailors");
var mySQL = "SELECT * FROM people";
adoRecordSet = adoConnection.Execute(mySQL);

while (adoRecordSet.Eof == false)
{
%]
and the adoConnection.Open("DSN=sailors"); is line 23
Old 02-06-03, 01:14 AM
  #5  
Mod Emeritus
Thread Starter
 
Gallant Pig's Avatar
 
Join Date: Aug 1999
Posts: 15,325
Likes: 0
Received 0 Likes on 0 Posts
Would this have anything to do with using Access XP and not being compatible with the ODBC driver or something?
Old 02-06-03, 01:20 AM
  #6  
X
Administrator
 
X's Avatar
 
Join Date: Oct 1987
Location: AA-
Posts: 10,763
Likes: 0
Received 4 Likes on 3 Posts
How about trying this in ASP:

oRST.Open "SELECT * FROM people;", "Driver=Microsoft Access Driver (*.mdb); DBQ=[complete path to db leaving out the brackets];"
Old 02-06-03, 03:10 AM
  #7  
Mod Emeritus
Thread Starter
 
Gallant Pig's Avatar
 
Join Date: Aug 1999
Posts: 15,325
Likes: 0
Received 0 Likes on 0 Posts
You are a genius X! Works great!
Old 02-06-03, 03:29 AM
  #8  
Mod Emeritus
Thread Starter
 
Gallant Pig's Avatar
 
Join Date: Aug 1999
Posts: 15,325
Likes: 0
Received 0 Likes on 0 Posts
BTW: As much as I hate the IDE, InterDev is definitely the best IDE I've used for coding ASP. It recognizes the recordset objects and can give me a choice of objects to choose from when I type "oRST." versus Dreamweaver MX not having that.

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Thread Tools
Search this Thread

Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service - Do Not Sell My Personal Information

Copyright 2018 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.