Accessing MS Access problem.

Discussion in 'ASP General' started by geoff.agnew@gmail.com, Apr 12, 2007.

  1. Guest

    Hi,

    I'm doing a web based tracking system for exam questions. Using ASP
    with VBScript to link the database. I have the main log in screen
    working but when i enter the log in details i get this error:

    - Error Type
    Provider (0x80004005)
    Unspecified error
    /ets/functions.asp, line 20

    my functions.asp file looks like below. I am a total beginner with ASP
    and VBScript by the way, any help would be awesome. cheers

    <!-- #INCLUDE FILE="adovbs.inc" -->
    <%

    '---------------------------------------------------------------------------
    ' Global Variables
    '---------------------------------------------------------------------------

    Dim cnnProject, cnnProjectUpdate



    '---------------------------------------------------------------------------
    ' Open Database
    '---------------------------------------------------------------------------

    Function OpenDatabase()
    Set cnnProject = Server.CreateObject("ADODB.Connection")
    cnnProject.ConnectionTimeout = 5
    cnnProject.CommandTimeout = 30
    cnnProject.Open DB_PROJECTS_CONN_STRING
    'Server.CreateObject("ADODB.Connection").Open
    "DBQ="&Server.MapPath("database/ets.mdb")&"; Driver={Microsoft Access
    Driver (*.mdb)};"
    End Function

    '---------------------------------------------------------------------------
    ' Close Database
    '---------------------------------------------------------------------------

    Function CloseDatabase()
    cnnProject.Close
    Set cnnProject = Nothing
    End Function


    '---------------------------------------------------------------------------
    ' Get User ID
    '---------------------------------------------------------------------------

    Function GetUserID()
    GetUserID = Session("UserID")
    End function



    '---------------------------------------------------------------------------
    ' Get User Password
    '---------------------------------------------------------------------------

    Function GetUserPassword(strUserID)
    Dim cnnLogin, rsUsers
    Dim strPassword

    strPassword = ""

    ' Create RS and query DB for quiz info
    Set rsUsers = Server.CreateObject("ADODB.Recordset")
    rsUsers.Open "SELECT * FROM Login WHERE TeamId="&strUserID&";",
    cnnProject

    If Not rsUsers.EOF Then
    strPassword = rsUsers("Password")
    End if

    rsUsers.Close
    Set rsUsers = Nothing

    GetUserPassword = strPassword
    End function

    '---------------------------------------------------------------------------
    ' Get User Password
    '---------------------------------------------------------------------------

    Function GetUserEmailAddress(strUserID)
    Dim cnnLogin, rsUsers
    Dim strEmailAddress

    strEmailAddress = ""

    ' Create RS and query DB for quiz info
    Set rsUsers = Server.CreateObject("ADODB.Recordset")
    rsUsers.Open "SELECT * FROM Login WHERE TeamId="&strUserID&";",
    cnnProject

    If Not rsUsers.EOF Then
    strEmailAddress = rsUsers("Email_Address")
    End if

    rsUsers.Close
    Set rsUsers = Nothing

    GetUserEmailAddress = strEmailAddress
    End function

    '---------------------------------------------------------------------------
    ' If the user is admin - logout
    '---------------------------------------------------------------------------
    Function isAdmin(login)
    Dim rsUsers


    ' Create RS and query DB for quiz info
    Set rsUsers = Server.CreateObject("ADODB.Recordset")
    rsUsers.Open "SELECT * FROM Login WHERE TeamId="&login&";",
    cnnProject

    If rsUsers("LogType")="Admin" Then
    Response.Redirect("Logout.asp")
    End if

    rsUsers.Close
    Set rsUsers = Nothing
    End function

    %>
    , Apr 12, 2007
    #1
    1. Advertising

  2. Eric Guest

    Hi Geoff,

    From the error code that you are getting, I would suggest that you check
    that your hosting company permits you to use MSAccess databases - they may
    have prevented "access" (excuse the pun).

    Rgds,

    Eric

    "" wrote:

    > Hi,
    >
    > I'm doing a web based tracking system for exam questions. Using ASP
    > with VBScript to link the database. I have the main log in screen
    > working but when i enter the log in details i get this error:
    >
    > - Error Type
    > Provider (0x80004005)
    > Unspecified error
    > /ets/functions.asp, line 20
    >
    > my functions.asp file looks like below. I am a total beginner with ASP
    > and VBScript by the way, any help would be awesome. cheers
    >
    > <!-- #INCLUDE FILE="adovbs.inc" -->
    > <%
    >
    > '---------------------------------------------------------------------------
    > ' Global Variables
    > '---------------------------------------------------------------------------
    >
    > Dim cnnProject, cnnProjectUpdate
    >
    >
    >
    > '---------------------------------------------------------------------------
    > ' Open Database
    > '---------------------------------------------------------------------------
    >
    > Function OpenDatabase()
    > Set cnnProject = Server.CreateObject("ADODB.Connection")
    > cnnProject.ConnectionTimeout = 5
    > cnnProject.CommandTimeout = 30
    > cnnProject.Open DB_PROJECTS_CONN_STRING
    > 'Server.CreateObject("ADODB.Connection").Open
    > "DBQ="&Server.MapPath("database/ets.mdb")&"; Driver={Microsoft Access
    > Driver (*.mdb)};"
    > End Function
    >
    > '---------------------------------------------------------------------------
    > ' Close Database
    > '---------------------------------------------------------------------------
    >
    > Function CloseDatabase()
    > cnnProject.Close
    > Set cnnProject = Nothing
    > End Function
    >
    >
    > '---------------------------------------------------------------------------
    > ' Get User ID
    > '---------------------------------------------------------------------------
    >
    > Function GetUserID()
    > GetUserID = Session("UserID")
    > End function
    >
    >
    >
    > '---------------------------------------------------------------------------
    > ' Get User Password
    > '---------------------------------------------------------------------------
    >
    > Function GetUserPassword(strUserID)
    > Dim cnnLogin, rsUsers
    > Dim strPassword
    >
    > strPassword = ""
    >
    > ' Create RS and query DB for quiz info
    > Set rsUsers = Server.CreateObject("ADODB.Recordset")
    > rsUsers.Open "SELECT * FROM Login WHERE TeamId="&strUserID&";",
    > cnnProject
    >
    > If Not rsUsers.EOF Then
    > strPassword = rsUsers("Password")
    > End if
    >
    > rsUsers.Close
    > Set rsUsers = Nothing
    >
    > GetUserPassword = strPassword
    > End function
    >
    > '---------------------------------------------------------------------------
    > ' Get User Password
    > '---------------------------------------------------------------------------
    >
    > Function GetUserEmailAddress(strUserID)
    > Dim cnnLogin, rsUsers
    > Dim strEmailAddress
    >
    > strEmailAddress = ""
    >
    > ' Create RS and query DB for quiz info
    > Set rsUsers = Server.CreateObject("ADODB.Recordset")
    > rsUsers.Open "SELECT * FROM Login WHERE TeamId="&strUserID&";",
    > cnnProject
    >
    > If Not rsUsers.EOF Then
    > strEmailAddress = rsUsers("Email_Address")
    > End if
    >
    > rsUsers.Close
    > Set rsUsers = Nothing
    >
    > GetUserEmailAddress = strEmailAddress
    > End function
    >
    > '---------------------------------------------------------------------------
    > ' If the user is admin - logout
    > '---------------------------------------------------------------------------
    > Function isAdmin(login)
    > Dim rsUsers
    >
    >
    > ' Create RS and query DB for quiz info
    > Set rsUsers = Server.CreateObject("ADODB.Recordset")
    > rsUsers.Open "SELECT * FROM Login WHERE TeamId="&login&";",
    > cnnProject
    >
    > If rsUsers("LogType")="Admin" Then
    > Response.Redirect("Logout.asp")
    > End if
    >
    > rsUsers.Close
    > Set rsUsers = Nothing
    > End function
    >
    > %>
    >
    >
    Eric, Apr 18, 2007
    #2
    1. Advertising

  3. joeyjoejnr Guest

    On Apr 18, 10:38 am, Eric <> wrote:
    > Hi Geoff,
    >
    > From the error code that you are getting, I would suggest that you check
    > that your hosting company permits you to use MSAccess databases - they may
    > have prevented "access" (excuse the pun).
    >
    > Rgds,
    >
    > Eric
    >
    > "" wrote:
    > > Hi,

    >
    > > I'm doing a web based tracking system for exam questions. Using ASP
    > > with VBScript to link the database. I have the main log in screen
    > > working but when i enter the log in details i get this error:

    >
    > > - Error Type
    > > Provider (0x80004005)
    > > Unspecified error
    > > /ets/functions.asp, line 20

    >
    > > my functions.asp file looks like below. I am a total beginner with ASP
    > > and VBScript by the way, any help would be awesome. cheers

    >
    > > <!-- #INCLUDE FILE="adovbs.inc" -->
    > > <%

    >
    > > '---------------------------------------------------------------------------
    > > ' Global Variables
    > > '---------------------------------------------------------------------------

    >
    > > Dim cnnProject, cnnProjectUpdate

    >
    > > '---------------------------------------------------------------------------
    > > ' Open Database
    > > '---------------------------------------------------------------------------

    >
    > > Function OpenDatabase()
    > > Set cnnProject = Server.CreateObject("ADODB.Connection")
    > > cnnProject.ConnectionTimeout = 5
    > > cnnProject.CommandTimeout = 30
    > > cnnProject.Open DB_PROJECTS_CONN_STRING
    > > 'Server.CreateObject("ADODB.Connection").Open
    > > "DBQ="&Server.MapPath("database/ets.mdb")&"; Driver={Microsoft Access
    > > Driver (*.mdb)};"
    > > End Function

    >
    > > '---------------------------------------------------------------------------
    > > ' Close Database
    > > '---------------------------------------------------------------------------

    >
    > > Function CloseDatabase()
    > > cnnProject.Close
    > > Set cnnProject = Nothing
    > > End Function

    >
    > > '---------------------------------------------------------------------------
    > > ' Get User ID
    > > '---------------------------------------------------------------------------

    >
    > > Function GetUserID()
    > > GetUserID = Session("UserID")
    > > End function

    >
    > > '---------------------------------------------------------------------------
    > > ' Get User Password
    > > '---------------------------------------------------------------------------

    >
    > > Function GetUserPassword(strUserID)
    > > Dim cnnLogin, rsUsers
    > > Dim strPassword

    >
    > > strPassword = ""

    >
    > > ' Create RS and query DB for quiz info
    > > Set rsUsers = Server.CreateObject("ADODB.Recordset")
    > > rsUsers.Open "SELECT * FROM Login WHERE TeamId="&strUserID&";",
    > > cnnProject

    >
    > > If Not rsUsers.EOF Then
    > > strPassword = rsUsers("Password")
    > > End if

    >
    > > rsUsers.Close
    > > Set rsUsers = Nothing

    >
    > > GetUserPassword = strPassword
    > > End function

    >
    > > '---------------------------------------------------------------------------
    > > ' Get User Password
    > > '---------------------------------------------------------------------------

    >
    > > Function GetUserEmailAddress(strUserID)
    > > Dim cnnLogin, rsUsers
    > > Dim strEmailAddress

    >
    > > strEmailAddress = ""

    >
    > > ' Create RS and query DB for quiz info
    > > Set rsUsers = Server.CreateObject("ADODB.Recordset")
    > > rsUsers.Open "SELECT * FROM Login WHERE TeamId="&strUserID&";",
    > > cnnProject

    >
    > > If Not rsUsers.EOF Then
    > > strEmailAddress = rsUsers("Email_Address")
    > > End if

    >
    > > rsUsers.Close
    > > Set rsUsers = Nothing

    >
    > > GetUserEmailAddress = strEmailAddress
    > > End function

    >
    > > '---------------------------------------------------------------------------
    > > ' If the user is admin - logout
    > > '---------------------------------------------------------------------------
    > > Function isAdmin(login)
    > > Dim rsUsers

    >
    > > ' Create RS and query DB for quiz info
    > > Set rsUsers = Server.CreateObject("ADODB.Recordset")
    > > rsUsers.Open "SELECT * FROM Login WHERE TeamId="&login&";",
    > > cnnProject

    >
    > > If rsUsers("LogType")="Admin" Then
    > > Response.Redirect("Logout.asp")
    > > End if

    >
    > > rsUsers.Close
    > > Set rsUsers = Nothing
    > > End function

    >
    > > %>


    hi,

    managed to get it sorted in the end. something stupid on my part.
    cheers for your help
    joeyjoejnr, Apr 18, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George
    Replies:
    1
    Views:
    14,308
    shijobaby
    Feb 6, 2010
  2. Russell Read [MSFT]

    Accessing an Access Database

    Russell Read [MSFT], Nov 14, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    5,393
    aliciap1214
    Jul 18, 2006
  3. =?Utf-8?B?TWljaGFlbCBTTA==?=

    Accessing Microsoft Access Table Definition

    =?Utf-8?B?TWljaGFlbCBTTA==?=, Feb 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    8,226
    =?Utf-8?B?TWljaGFlbCBTTA==?=
    Feb 27, 2004
  4. James Bird
    Replies:
    1
    Views:
    535
    Joe Gass
    Apr 8, 2004
  5. S
    Replies:
    2
    Views:
    142
    Val Mazur
    Apr 22, 2004
Loading...

Share This Page