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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Page With ODBC Connection Giving Error 2

Status
Not open for further replies.

gwillr

IS-IT--Management
Nov 4, 2003
267
0
0
CA
I have a page, list.asp, that retrieves information from an access database and displays it for the user. After moving to a new server, i get the following error:

Technical Information (for support personnel)

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

Here is the code:
Code:
<% LANGUAGE="VBSCRIPT" %>
<% response.buffer = True%>
<!-- #INCLUDE FILE="../DataStore.inc" -->
<!-- #INCLUDE FILE="../adovbs.inc" -->
<!-- #INCLUDE FILE = "security.inc" -->
<%
'this page lists the current accounts
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Current Accounts</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
</head>

<body>

<p align="center"><b><font face="Verdana" color="#282484">[Current Users]</font></b></p>
<div align="center"><center>

<table border="2" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF" bordercolor="#000000"
bordercolorlight="#000000" bordercolordark="#000000">
  <tr>
    <td bgcolor="#282484"><p align="center"><b>
    <font color="#FFFF99" face="Verdana" style="font-size: 12px">E-Mail Address</font></b></td>
    <td bgcolor="#282484"><p align="center"><b>
    <font color="#FFFF99" face="Verdana" style="font-size: 12px">Name</font></b></td>
    <td bgcolor="#282484"><p align="center"><b>
    <font color="#FFFF99" face="Verdana" style="font-size: 12px">Delete User</font></b></td>
  </tr>
 <%
'declare variables
	  Dim objRec           'recordset object

	'create the recordset object
	  Set objRec = Server.CreateObject ("ADODB.Recordset")

	'now open it
	  objRec.open "EMailList", strConnect, adOpenKeyset, _
		  adLockReadOnly, adCmdTable

	'loop once through the records
	  While Not objRec.EOF
	    'display the e-mail address in the table
	      Response.Write("<tr><td><p align=""center""><a href=""mailto:")
	      Response.Write(objRec("EMail"))
	      Response.Write(""">")
	      Response.Write(objRec("EMail"))
	    'display the Name in the table
	      Response.Write("</a></td><td><p align=""center""><a href=""mailto:")
	      Response.Write(objRec("Name"))
	      Response.Write(""">")
	      Response.Write(objRec("Name"))

	    'put a link to the delete script to delete the user
	      Response.Write("</a></td><td><p align=""center""><a href=""delete.asp?id=")
	      Response.Write(objRec("ID"))
	      Response.Write("""><u><font color=""#FF0000"">X</font></u></a></td></tr>")
	    'go to the next record
 objRec.MoveNext
	  Wend
	
	'clean everything up
	  objRec.Close
	  Set objRec = Nothing
%> 
</table>
</center></div>
</body>
</html>

I have set up the ODBC connection with the msacess driver, as a system DSN named EMailList, and have given the proper permissions as far as i can tell.

any suggestions for solution would be appreciated.

Gary
 
if sure DSN is set up correct then
what is the value of strconnect if you do a response write on it

try putting at line 39
RESPONSE.WRITE STRCONNECT
RESPONSE.END

to ensure you have corretcly configured DSN string



 
i agree, also in your code there's no visible connection set up i'm assuming it's done in one of the includes, it's wise to place connection.close and set connection=nothing at the end of your page to clear our the connections, especially with access, because that hanging connection may stop someone else from getting info.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Thanks sdh, and DreXor.......I feel silly, as it was in fact a problem with the DSN connection. DreXor's post prompted me to double check the includes, and in fact, i forgot to change the directory path in the datastore include that should have been doen due to the slight change after the move. all works now...thanks to both for the insight.

Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top