Error messages: cannot conect to Access data base

Results 1 to 3 of 3

Thread: Error messages: cannot conect to Access data base

  1. #1
    Join Date
    Dec 1969
    Posts
    22

    Default Error messages: cannot conect to Access data base

    Hi,<BR><BR>I&#039m trying out a sample which I downloaded from http://www.attitude.com/users/kathi/asp/samples.html . The asp file should generate the contents of the data base in a table. I am having trouble connecting to it. I guess I am pretty clueless on how to properly link to the database. I followed all the instructions on the afore mentioned webpage, but to no avail.<BR><BR>I made a DNS name: "samples" in the System DNS under Control Panel linking it to the MS Access driver and to a file "Samples.mdb", which is in the same directory as the asp file. MS Access is run from the local network. The website I am working with is on a server with NT4. <BR><BR>I receive the following error message:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80004005&#039 <BR><BR>[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified <BR><BR>/wbk/public/sgm/test/sample1.asp, line 17 <BR><BR><BR>The code of the asp file "sample1.asp" is:<BR><BR>&#060;html&#062;<BR>&#060;head&#062;<BR >&#060;title&#062;ASP Sample Script 1&#060;/title&#062;<BR>&#060;meta http-equiv="expires" content="0"&#062;<BR>&#060;/head&#062;<BR>&#060;body bgcolor="#ffffff"&#062;<BR>&#060;center&#062;<BR>& #060;table width=600 border=1 cellpadding=5 cellspacing=0&#062;<BR> &#060;%<BR> &#039 first create a recordset object<BR> set rs=Server.CreateObject("adodb.Recordset")<BR> &#039 next set up a connection string<BR> connectme="dns=samples"<BR> &#039 now set up a query for the database<BR> sqlstmt = "SELECT * from Sample"<BR> &#039 connect to the database and execute query<BR> rs.open sqlstmt, connectme<BR> &#039 if the recordset is empty we will quit<BR> &#039 and display a message using a conditional<BR> &#039 if...then...else statement<BR> If rs.eof then<BR> response.write "&#060;center&#062;There are no records in the database"<BR> response.write "<BR>Please check back later&#060;/center&#062;"<BR> response.end<BR> Else<BR> &#039 close the script for now to add some HTML<BR> %&#062;<BR> &#060;tr&#062;<BR> &#060;td colspan=4 align="center"&#062;<BR> &#060;font face="times new roman"&#062;<BR> &#060;i&#062;&#060;h1&#062;Sample Script 1&#060;/h1&#062;&#060;/i&#062;<BR> &#060;/font&#062;<BR> &#060;/td&#062;<BR> &#060;/tr&#062;<BR><BR> &#060;tr&#062;<BR> &#060;td&#062;&#060;b&#062;Name&#060;/b&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;b&#062;City&#060;/b&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;b&#062;State&#060;/b&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;b&#062;Country&#060;/b&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR><BR> &#060;%<BR> &#039 loop through the records and display the information<BR> &#039 using a Do While...Loop statement<BR> Do while not rs.eof<BR> Name = rs("Name")<BR> City = rs("City")<BR> State = rs("State")<BR> Country = rs("Country")<BR> &#039 close the script for now to write in some HTML<BR> %&#062;<BR><BR> &#060;tr&#062;<BR> &#060;td&#062;&#060;%= Name %&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;%= City %&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;%= State %&#062;&#060;/td&#062;<BR> &#060;td&#062;&#060;%= Country %&#062;&#060;/td&#062;<BR> &#060;/tr&#062;<BR> &#060;%<BR> &#039 move to the next record<BR> rs.MoveNext<BR> &#039 go get another record<BR> loop<BR> End If<BR> %&#062;<BR><BR>&#060;/table&#062;<BR> &#060;!-- This is inserted for the sample only --&#062;<BR> &#060;form&#062;<BR> &#060;input type="button" value="Close This Window" onClick="window.close()"&#062;<BR> &#060;/form&#062;<BR>&#060;/center&#062;<BR>&#060;/body&#062;<BR>&#060;/html&#062;

  2. #2
    Join Date
    Dec 1969
    Posts
    716

    Default RE: Error messages: cannot conect to Access data b

    Hi,<BR><BR>The error message:<BR><BR>[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified <BR><BR>Essentially means that the Data Source (in this case the MS Access Database) cannot be found. In my humble experience this nearly always points to a incorrectly named or missing DSN.<BR><BR>In your code you had the following line:<BR><BR>connectme="dns=samples"<BR><BR>It should read as:<BR><BR>connectme="dsn=samples"<BR><BR>Correcti ng that should well do the trick =)<BR><BR>Hope it helped.<BR><BR>Justin

  3. #3
    Joshua Dearth Guest

    Default RE: Error messages: cannot conect to Access data b

    Just a hint, I struggled with this problem for a while. Make sure the DSN your are using is a system DSN. A local DSN is not compatible with ASP<BR><BR>J.D.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •