Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

80004005 ERROR

Status
Not open for further replies.

lukechapman

Programmer
Joined
Oct 23, 2001
Messages
5
Location
GB
Hello,
I've got a problem with the following script:
*********************************************

<!-- #INCLUDE FILE=&quot;dsn.inc&quot; -->
<%
Dim db 'the database connection object
Dim rs 'recordset, for select statements
Dim cmd 'a command object, for inserts, updates and deletes


Function DbInit
Set db = Server.CreateObject(&quot;ADODB.Connection&quot;)
db.Open strConnect

Set rs = Server.CreateObject (&quot;ADODB.RecordSet&quot; )
rs.ActiveConnection = db
rs.CursorType = adOpenForwardOnly
rs.LockType = adLockReadOnly

Set cmd = Server.CreateObject (&quot;ADODB.Command&quot; )
cmd.CommandType = adCmdText
Set cmd.ActiveConnection = db
End Function


Function DbUpdateNotice(aId, aTitle, aText, aContrib, aExpiryCode)
Dim sTitle, sText, sContrib
sTitle = replace(aTitle,&quot;'&quot;,&quot;''&quot;)
sText = replace(aText,&quot;'&quot;,&quot;''&quot;)
sContrib = replace(aContrib,&quot;'&quot;,&quot;''&quot;)
cmd.CommandText = &quot;update Notices &quot; _
& &quot; set Title='&quot; & sTitle & &quot;', Contributor='&quot; & sContrib & &quot;',&quot; _
& &quot; [Text]='&quot; & sText & &quot;',Expiry='&quot; & aExpiryCode & &quot;'&quot; _
& &quot; where Id=&quot; & Request(&quot;aId&quot;)
cmd.Execute
End Function

Function DbInsertNotice(aGroupType, aGroupCode, aTitle, aText, aContrib, aExpiryCode)
Dim sTitle, sText, sContrib
sTitle = replace(aTitle,&quot;'&quot;,&quot;''&quot;)
sText = replace(aText,&quot;'&quot;,&quot;''&quot;)
sContrib = replace(aContrib,&quot;'&quot;,&quot;''&quot;)
cmd.CommandText = &quot;Insert into Notices&quot; _
& &quot;(GroupType,GroupCode,Title,[Text],Contributor,Expiry) &quot; _
& &quot; values('&quot; & aGroupType & &quot;','&quot; & aGroupCode &&quot;','&quot; & sTitle & &quot;','&quot; & sText & &quot;','&quot; _
& sContrib & &quot;','&quot; & aExpiryCode & &quot;')&quot;
cmd.Execute
End Function

Function DbDeleteNotice(aId)
cmd.CommandText = &quot;delete from Notices where Id=&quot; & aId
cmd.Execute
End Function

Function DbDeleteNotices(aIdList)
cmd.CommandText = &quot;delete from Notices where Id in (&quot; & aIdList & &quot;)&quot;
cmd.Execute
End Function

Function TimeStamp
TimeStamp = Year(Now()) & Month(Now()) & Day(Now()) & Hour(Now()) & Minute(Now()) & Second(Now())
End Function

Function FileExt(filename)
FileExt = Right(filename,len(filename)-instrRev(filename,&quot;.&quot;)+1)
End Function

Sub DbInsertAttachment(aClientFilename, aServerFilename, aDocTitle, aPupilId, aDocType, aFileSize, aAddedBy)
Dim sDocTitle,sql
sDocTitle = replace(aDocTitle,&quot;'&quot;,&quot;''&quot;)
sql = &quot;Insert into Attachments&quot; _
& &quot;(ServerFilename,ClientFilename,PupilId,DocTitle,DocType,FileSize,AddedBy) &quot; _
& &quot; values('&quot; & aServerFilename & &quot;','&quot; & aClientFilename &&quot;','&quot; & aPupilId & &quot;','&quot; & sDocTitle & &quot;','&quot;_
& aDocType & &quot;',&quot; & aFileSize & &quot;,'&quot; & aAddedBy & &quot;')&quot;
cmd.CommandText = sql
cmd.Execute
End Sub

Sub DbMarkVisit(aUserId,aUserRole)
cmd.CommandText = &quot;update Users set DateLastAccessed=Now() &quot; _
& &quot; where Id='&quot; & aUserId & &quot;' and Role='&quot; & aUserRole & &quot;'&quot;
cmd.Execute
End Sub

Function DbClose
Set rs = Nothing
Set cmd = Nothing
Set db = Nothing
End Function

Function ExtractFilenameOnly(aFilename)
' NB. THIS IS DESIGNED TO WORK WITH DOS PATHS (BACKSLASHES) ONLY
Dim ipos, s
' 1. Find and remove any file extension
s = aFilename
ipos = InStrRev(s, &quot;.&quot;)
If ipos > 0 Then
s = Left(s, ipos-1)
End If
' 2. Find and remove any path
ipos = InStrRev(aFilename, &quot;\&quot;)
If ipos > 0 Then
s = Right(s, Len(s)-ipos)
End If
ExtractFilenameOnly = s
End Function

%>

*****************************************************

The error I get is:

Microsoft JET Database Engine error '80004005'
Unspecified error
/common_asp.inc, line 10

******************************************************

I've checked the DB and all of columns are there and correct and I think the sql statements are correct. Any ideas?
 
Hey Luke,

The error is calling on line 10 in /common_asp.inc is that the document we're looking at. Because I don't see any problems near line ten with maybe the exception of a problem in your DSN variable. Can you show us what your dsn.inc include file looks like as well as /common_asp.inc if that's not what we're already looking at.

ToddWW
 
sure,
you are looking at common_asp.inc

the DSN is set in dsn.inc, which is:
<%
Dim strConnect
strConnect = &quot;File Name=e:\websites\bhs4parents\pmxl.udl&quot;
%>

and pmxl.udl is:
[oledb]
; Everything after this line is an OLE DB initstring
Provider=Microsoft.Jet.OLEDB.4.0;Password=&quot;&quot;;Data Source=E:\db\pmxl.mdb;Persist Security Info=True

thanks for looking into this!
 
Hmm. I've never seen that convention used before. Have you just tried this.. For testing purposes.
Code:
<%
Dim strConnect
strConnect = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Password=&quot;&quot;;Data Source=E:\db\pmxl.mdb;Persist Security Info=True&quot;
%>
Assuming everything is correct in the string, that should work. Here's an alternate option. This is the string I use to connect to Access databases.
Code:
<%
Dim strConnect
strConnect = &quot;Driver={Microsoft Access Driver (*.mdb)};DBQ=E:\db\pmxl.mdb&quot;
%>
Try those. You should at least get past that connection error.

ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top