Click to See Complete Forum and Search --> : help help help


stormrevolution
12-05-2003, 05:16 PM
ok, got a password/login script. loaded to my webserver and i keep getting the following error:


ADODB.Connection.1 error '80004005'

SQLState: IM002
Native Error Code: 0
[INTERSOLV][ODBC lib] Data source name not found and no default driver specified


inc_common.asp, line 31


this is what is in inc_common.asp with line 31 highlighted blue:

<%
If isCommonCreated <> True Then
'Set the script timeout in seconds
Server.ScriptTimeout = 90

'Set Dimension Variables
Dim strDataBasePath 'Holds the path to the database
Dim cString 'Holds the connection string
Dim adoCon 'Holds the ado connection
Dim strSQL 'Holds SQL string

'Set the variable to hold an ADO connection
Set adoCon = Server.CreateObject("ADODB.Connection")

'------------------------------------------------------------------------------------
'Change this value to the path of the database
strDataBasePath = "/login/users.mdb"
'------------------------------------------------------------------------------------

'Connection string for the database
'If the following line does not work comment it out with a ' at the start of the line and uncomment another string
cString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strDataBasePath)

'Uncomment this connection string if you are using Access Database 2000 or 2002
'cString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(strDataBasePath)

'Uncomment this connection string if you are using a DSN (note: DSN is slower than the above connection strings)
'cString = "DSN=NAME_OF_DSN"
'Replace the NAME_OF_DSN with the DSN

adoCon.Open cString

'Request the users details

'Set the variable to the value in the users cookie
str_userscode = Request.Cookies("Login")("userCode")

'If the users code is not empty then
IF str_userscode <> "" THEN
'Create a new record set
Set rsUserLog = Server.CreateObject("ADODB.RecordSet")

'Set the new sql string
StrSql="SELECT * FROM tbl_authors WHERE code='" & str_userscode & "';"

'Open the recordset and execute the sql
rsUserLog.open StrSql,cString

'If there is no record matching the users cookie details then set the vairbales to empty
If rsUserLog.EOF Then
Response.cookies("Login")("userCode") = ""
'If there is a record to match then
Else
'Set the database values to variables
str_users_name = rsUserLog("name")
str_users_password = rsUserLog("pass")
str_users_fullname = rsUserLog("fullname")
str_users_email = rsUserLog("email")
str_users_address = rsUserLog("address")
str_users_phone = rsUserLog("phone")
str_users_city = rsUserLog("city")
str_users_state = rsUserLog("state")
str_users_zip = rsUserLog("zip")
str_users_package = rsUserLog("package")
str_users_authority = rsUserLog("authority")
str_users_date = rsUserLog("signupdate")
str_users_code = rsUserLog("code")
str_users_status = rsUserLog("status")
str_users_projectname = rsUserLog("projectname")
str_users_projecturl = rsUserLog("projecturl")
str_users_suspensionreason = rsUserLog("suspensionreason")
End If

'Close and clean up
rsUserLog.Close
set rsUserLog = Nothing

'If users code is empty then user is a Guest
Else
Response.cookies("Login")("userCode") = ""
End If

'--------------------------------------------------------------------------------------------
'This section finds all information about the style of the webpage so it can be displayed.

'Create a new record set
set rsPageAttributes = Server.CreateObject("ADODB.RecordSet")

'Set the new sql string
pageSql = "SELECT * FROM tbl_admin"

'Open the recordset and execute the sql
rsPageAttributes.open pageSql,cString

adminEmail = rsPageAttributes("adminEmail")
bgColor = rsPageAttributes("bgColor")
tableColor = rsPageAttributes("tableColor")
menuColor = rsPageAttributes("menuColor")
fontColor = rsPageAttributes("fontColor")
fontFace = rsPageAttributes("fontFace")
fontSize = rsPageAttributes("fontSize")
fontWeight = rsPageAttributes("fontWeight")
aLinkColor = rsPageAttributes("aLinkColor")
aLinkUnderline = rsPageAttributes("aLinkUnderline")
aLinkWeight = rsPageAttributes("aLinkWeight")
aHoverColor = rsPageAttributes("aHoverColor")
aHoverUnderline = rsPageAttributes("aHoverUnderline")
aHoverWeight = rsPageAttributes("aHoverWeight")
menuLinkColor = rsPageAttributes("menuLinkColor")
menuLinkHoverColor = rsPageAttributes("menuLinkHoverColor")
pageTitle = rsPageAttributes("siteTitle")
homePage = rsPageAttributes("homePage")
mailServer = rsPageAttributes("mailHost")
mailType = rsPageAttributes("mailType")
sendConfEmail = rsPageAttributes("sendConfEmail")
errorColor = rsPageAttributes("errorColor")

'Close and clean up
rsPageAttributes.Close
set rsPageAttributes = Nothing

'--------------------------------------------------------------------------------------------
Else
Dim isCommonCreated
isCommonCreated = True
End If
'--------------------------------------------------------------------------------------------
'Function to print header logo
Function printLogo
'Create a new record set
set rsPrintLogo = server.createobject("ADODB.RecordSet")

'Set the new sql string
logoSql = "SELECT * FROM tbl_admin"

'Open the recordset and execute the sql
rsPrintLogo.open logoSql,cString

binaryLogo = rsPrintLogo("headerLogo")

'Close and clean up
rsPrintLogo.Close
Set rsPrintLogo = Nothing
printLogo = rsPrintLogo
End Function
'--------------------------------------------------------------------------------------------

'--------------------------------------------------------------------------------------------
'Function to return the state of adoCon in a string value
Function GetState(intState)
Select Case intState
Case 0
GetState = "adStateClosed"
Case 1
GetState = "adStateOpen"
End Select
'Syntax: GetState(adoCon.state)
End Function
'--------------------------------------------------------------------------------------------
%>

Any help on how to fix this would be great, cheers all!!

simflex
12-06-2003, 10:53 AM
First of all, are you sure that your db is in the level that the include file says it is?

Your code can't find this path:
strDataBasePath = "/login/users.mdb

I usually keep it simple by creating a dsn for my db and use a simple connection string like this:

Set adoCon= Server.CreateObject("ADODB.Connection")
adoCon.Open "DSNMAME"

I use this connection method only for access db.

So if I were you, I will delete this portion:

'Set the variable to hold an ADO connection
Set adoCon = Server.CreateObject("ADODB.Connection")

'------------------------------------------------------------------------------------
'Change this value to the path of the database
strDataBasePath = "/login/users.mdb"
'------------------------------------------------------------------------------------

'Set the variable to hold an ADO connection
Set adoCon = Server.CreateObject("ADODB.Connection")

'------------------------------------------------------------------------------------
'Change this value to the path of the database
strDataBasePath = "/login/users.mdb"
'------------------------------------------------------------------------------------

'Connection string for the database
'If the following line does not work comment it out with a ' at the start of the line and uncomment another string
cString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(strDataBasePath)

'Uncomment this connection string if you are using Access Database 2000 or 2002
'cString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(strDataBasePath)

'Uncomment this connection string if you are using a DSN (note: DSN is slower than the above connection strings)
'cString = "DSN=NAME_OF_DSN"
'Replace the NAME_OF_DSN with the DSN

adoCon.Open cString


Then add this line immediately after the sql statement:
set rsUserLog = adoCon.execute(sql)

If you use this method, the only reason your code won't work is if you don't your dsn correctly to point to the users.mdb.

stormrevolution
12-06-2003, 06:32 PM
ok, i think ive fixed the above problem, but now i get this error:

ADODB.Recordset.1 error '80004005'

SQLState: IM002
Native Error Code: 0
[INTERSOLV][ODBC lib] Data source name not found and no default driver specified


inc_common.asp, line 93

this is what is on line 93:

rsPageAttributes.open pageSql,cString

cheers for all your help so far.