Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 1st, 2005, 08:38 AM
Authorized User
 
Join Date: Jun 2003
Location: Jewett City, CT, USA.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default Closing Database Connection

I am having some difficulty with an ASP file I'm working with. All I'm doing is searching a database for a particular user's name in the database. The page will work the first time it's run, but if I try to refresh the page, I get an error that says:
"Error Type:
Provider (0x80004005)
Unspecified error
/IMI/login.asp, line 12"

Line 12 in the login.asp is:
adoConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\Inetpub\wwwroot\IMI\StudentData.mdb"

I'm pretty sure this has something to do with the connection. Anyway, here's my entire page of code:
<%@Language=VBScript%>
<%
    dim fName, lName, ssn, returnVal

    fName = Request.Form("FirstName")
    lName = Request.Form("LastName")
    ssn = Request.Form("SSN")

    dim adoConn, rsStudents, strSql
    Set adoConn = Server.CreateObject("ADODB.Connection")
    adoConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\Inetpub\wwwroot\IMI\StudentData.mdb"
    set rsStudent = Server.CreateObject("ADODB.Recordset")
    strSql = "Select * From Students Where FirstName='"&fName&"' AND LastName='"&lName&"'"

    rsStudent.Open strSql, adoConn, adOpenKeyset
%>
<html>
    <body>
    <%
        returnVal = 0
        if rsStudent.EOF then
            returnVal = 1
        else
              'We know that we have at least one record (hopefully only one)
              'Set returnVal to 2 (wrong SSN) and if we find the correct SSN
              'we'll reset it to 0
              returnVal = 2
              rsStudent.MoveFirst
              While Not rsStudent.EOF
                  if ssn=rsStudent("SSN") then
                      returnVal = 0
                  end if
                  rsStudent.MoveNext
              Wend
          end if
     %>
     &Return=<%=returnVal%>
    </body>
</html>
<%
    adoConn.Close
    Set adoConn = Nothing
%>

I thought I had everything I needed with the Close and setting the connection to Nothing. Can someone please help me figure out what I've done wrong.

Chris

  #2 (permalink)  
Old June 1st, 2005, 02:46 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

chrscote,

The problem is likely with the Jet Engine or you don't have enough privilege to TEMP folder.

You are using old format of connectionstring there. Your connectionstring should be like this.

adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\IMI\StudentData.mdb;User Id=admin;Password=;"

Hope that helps.

_________________________
- Vijay G
Strive for Perfection
  #3 (permalink)  
Old June 1st, 2005, 05:57 PM
Registered User
 
Join Date: Jun 2005
Location: Spokane, WA, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To quote Wayne Berry:

"The latest MDAC drivers (anything in the past six months), and especially the Access ODBC driver, have a "feature" that REQUIRES a SYSTEM temp variable be establised. This is done from right clicking My Computer, choosing Properties, Environment, and adding the system variables of TMP C:\TEMP and TEMP C:\TEMP."

  #4 (permalink)  
Old June 2nd, 2005, 08:29 AM
Authorized User
 
Join Date: Jun 2003
Location: Jewett City, CT, USA.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks guys. It works great now.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing an ADO connection to a .DBF file tknnguyen Pro VB 6 2 July 25th, 2007 01:49 PM
closing an inet1 connection renu2214 VB How-To 5 April 17th, 2007 09:31 AM
Opening & Closing Database connections pauliehaha Classic ASP Databases 4 December 18th, 2006 08:50 AM
Closing an Access Database ru1 Access 4 February 1st, 2005 01:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.