Accessing MS Access problem.
Accessing MS Access problem.
am 12.04.2007 17:16:43 von geoff.agnew
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
<%
'----------------------------------------------------------- ----------------
' 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
%>
RE: Accessing MS Access problem.
am 18.04.2007 11:38:04 von Eric
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
>
>
> <%
>
> '----------------------------------------------------------- ----------------
> ' 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
>
> %>
>
>
Re: Accessing MS Access problem.
am 18.04.2007 14:06:38 von geoff.agnew
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
>
> "geoff.ag...@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
>
> >
> > <%
>
> > '----------------------------------------------------------- ----------------
> > ' 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