For Programmers: Free Programming Magazines  


Home > Archive > ASP > April 2007 > Accessing MS Access problem.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Accessing MS Access problem.
geoff.agnew@gmail.com

2007-04-12, 6:56 pm

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

2007-04-18, 7:55 am

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

"geoff.agnew@gmail.com" 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
>
> %>
>
>

joeyjoejnr

2007-04-18, 6:56 pm

On Apr 18, 10:38 am, Eric <E...@discussions.microsoft.com> wrote:[color=darkred]
> 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
>
> "geoff.ag...@gmail.com" wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

hi,

managed to get it sorted in the end. something stupid on my part.
cheers for your help

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com