Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems Connecting to Database

Status
Not open for further replies.

gnibbles

Programmer
Mar 15, 2000
79
CA
I cant seem to see what the heck is wrong with my code. Im just trying to connect to the database and display some information. IE keeps telling me that line 17 has problems which is the DBConn.Open "DSN=JobFiles" line. Heres the VBScript that I have in there. If anyone has any inkling to whats wrong let me know please.

<%
Dim DBConn
Dim recordSet

Set DBConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
DBConn.ConnectionTimeout = 60
DBConn.Open &quot;DSN = JobFiles&quot;

Set recordSet = Server.CreateObject(&quot;ADODB.Recordset&quot;)

recordSet.Open &quot;SELECT * FROM Jobs&quot;, DBConn

Do While NOT recordSet.EOF
Response.Write(recordSet(&quot;NAME&quot;))
Response.Write(&quot;<BR>&quot;)
recordSet.MoveNext

Loop

DBConn.Close
Set DBConn = Nothing
%>

gnibbles
nturpin@excite.com
 
what is it the error is stating

_________________________________________________________
[sub]$str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
$Nstr = ereg_replace(&quot;sleep&quot;,&quot;coffee&quot;,$str); echo $Nstr;[/sub]
onpnt2.gif
[sup] [/sub]
 
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/JobList3.asp, line 17


I have a System DSN created with the name that I have designated. Is there something else I have to do?

gnibbles
nturpin@excite.com
 
Did you setup the JobFiles system DSN on the server that's serving the pages? If so, did you test it using the Test Data Source button located at the bottom of the last step in setting up a DSN?
 
Yes I did all that.

gnibbles
nturpin@excite.com
 
What kind of Database are you using? Are you selecting the correct driver that your database requires?

IT Professional
 
I forgot to mention to check the spelling of you DSN and the reference to it in your Code.(i.e. JobFiles - Job Files)

IT Professional
 
Close up the spaces in this line

DBConn.Open &quot;DSN = JobFiles&quot;

should be

DBConn.Open &quot;DSN=JobFiles&quot;

It makes a difference !

BDC.
 
BDC2 has the right solution -- I had the very same problem once and learned about the spacing issue the hard way (desperation, in that case, led me to removing the spaces -- I was stunned when it suddenly worked).
 
Should it display the info in frontpage preview?

gnibbles
nturpin@excite.com
 
No, you have to publish an ASP script to a web server that has IIS installed in order to test it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top