CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 I can't shake off this err msg "Microsoft JET Database Engine (0x80004005)"

Print topic Send  topic

Author Message
Posted: 12/16/2003, 10:26 PM

This is a multi-part message in MIME format.

Content-Type: multipart/alternative;

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable


I get this error message and I've tried a million suggestions and =
nothing has worked:

Error Type:
Microsoft JET Database Engine (0x80004005)
Unspecified error
/form_to_db_asp/form_to_db.asp, line 154

I followed the instructions from this article, and it didn't work:

I've updated my Jet 4.0 to SP 8 and that didn't help. I've updated to =
Microsoft Data Access Components (MDAC) 2.8 and that didn't work either. =
I believe I'm using IIS 4 or IIS 5 but I'm not sure. The Access DB is =
made in Access 2000.

How can I make my code work.

I've attached my file in case anyone wants to look at the code.

Thanks in advance,

Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=3DContent-Type content=3D"text/html; =
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<DIV><FONT face=3DArial size=3D2>Hello, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I get this error message and I've =
tried a=20
million suggestions and nothing has worked:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#ff0000 size=3D2>Error =
Type:<BR>Microsoft JET Database=20
Engine (0x80004005)<BR>Unspecified =
error<BR>/form_to_db_asp/form_to_db.asp, line=20
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I followed the instructions from this =
article, and=20
it didn't work:</FONT></DIV>
<DIV><A =
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I've updated my Jet 4.0 to SP 8 and =
that didn't=20
help. I've updated to Microsoft Data Access Components (MDAC) 2.8 and =
didn't work either. I believe I'm using IIS 4 or IIS 5 but I'm not sure. =
Access DB is made in Access 2000.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>How can I make my code =
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I've attached my file in case anyone =
wants to look=20
at the code.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advance,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Razvan</FONT></DIV></BODY></HTML>


Content-Type: application/octet-stream;
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;

' Just in case you're not up on my acronyms:
' DB =3D database, RS=3Drecordset, CONN=3Dconnection
' o/w =3D otherwise

' Include the VBScript ADO constants file
<!-- #include file=3D"" -->

' *** Begin DB Setup ***

Dim strConnString
' Sample access OLEDB CONN String.
strConnString =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0; Data Source=3D" & =
Server.MapPath("\db\db_scratch.mdb") & ";"
' Override with our site-wide CONN string.
'strConnString =3D "Provider=3DSQLOLEDB;Data Source=3D10.2.1.214;" _
' & "Initial Catalog=3Dsamples;User Id=3Dsamples;Password=3Dpassword;" _
' & "Connect Timeout=3D15;Network Library=3Ddbmssocn;"

' Access likes #, but SQL Server expects ' so you'll need to change
' this based on the DB you're using.

' *** End DB Setup ***

Dim cnnFormToDB ' CONN object
Dim strSQL ' String in which to build our SQL command
Dim lngRecsAffected ' # of records affected... just informational

' Vars for the fields read in from the form. All fields are read
' in as strings so I need to covert them to the appropriate data
' types to be sure they're appropriate for the DB fields. These
' variables give me some working space to do this easily.
Dim strTextField ' text field
Dim intIntegerField ' integer field
Dim datDateTimeField ' date field

Dim strErrorMsg ' Holds error message if we catch any problems.

' See if we have any info to process.
' If we don't (ie. the first time through) we just show
' the form. If we do we proceed with the insert.
If Request.Form("action") <> "Save Form Data" Then
' Show the form
<form action=3D"<%=3D Request.ServerVariables("SCRIPT_NAME") %>" =
<input type=3D"hidden" name=3D"action" value=3D"Save Form Data" />
<table border=3D"0">
<td align=3D"right"><strong>Text Field:</strong></td>
<td align=3D"left"><input type=3D"text" name=3D"text_field" =
maxlength=3D"10" /></td>
<td align=3D"right"><strong>Integer Field:</strong></td>
<td align=3D"left"><input type=3D"text" name=3D"integer_field" /></td>
<td align=3D"right"><strong>Date/Time Field:</strong></td>
<td align=3D"left"><input type=3D"text" name=3D"date_time_field" =
<td> </td>
<input type=3D"reset" value=3D"Clear" />
<input type=3D"submit" value=3D"Save" />
' Do our DB insert!

' Retrieve the 3 strings to be entered into the DB
strTextField =3D Request.Form("text_field")
intIntegerField =3D Request.Form("integer_field")
datDateTimeField =3D Request.Form("date_time_field")

' Start error handling... I'm too lazy to check all the criteria
' on my own so I use VBScript to do it for me. I simply do a
' conversion the the expected type and if it fails I catch the
' error, abort the insert, and display a message.
On Error Resume Next
strErrorMsg =3D ""
' String (text) field:
' Nothing should really go wrong here. It's already a string so
' I don't bother with a CStr. I do replace ' with '' for the
' validity our SQL statement and also check to make sure it's
' not an empty string. If it is an empty string ("") then I
' throw a fake error since I've already got this type of error
' handling in place... hey I already admitted I was lazy!
strTextField =3D Trim(strTextField)
If Len(strTextField) =3D 0 Or Len(strTextField) > 10 Then Err.Raise 1
strTextField =3D Replace(strTextField, "'", "''")
intIntegerField =3D Replace(intIntegerField, "'", "''")
datDateTimeField =3D Replace(datDateTimeField, "'", "''")
If Err.number <> 0 Then
strErrorMsg =3D strErrorMsg & "Your entry for string_field is " & _
"inappropriate!<br />" & vbCrLf
End If

' Integer field:
' Lots of possible problems here. First off it could be text and
' not a number at all! Even if it is a number, there are a lot
' of restrictions on integers. It needs to be a whole number and
' it's absolute value can't be bigger than around 32,000. Using
' CInt I don't have to worry about it though.
intIntegerField =3D CInt(intIntegerField)
If Err.number <> 0 Then
strErrorMsg =3D strErrorMsg & "Your entry for integer_field could " & =
"not be converted to an integer! Remember that integers " & _
"need to be from -32,768 to 32,767.<br />" & vbCrLf
End If =09
' Date field:
' Well it needs to be a valid date. You can enter it in any format
' the computer can understand. Doing the CDate will not only make
' sure it's a date, but will also make them all nice and uniform!
datDateTimeField =3D CDate(datDateTimeField)
If Err.number <> 0 Then
strErrorMsg =3D strErrorMsg & "Your entry for date_time_field could " =
& _
"not be converted to an date variable!<br />" & vbCrLf
End If

' I don't know if this is really documented or a hack,
' but it turns error trapping back off!
On Error Goto 0

' If we have an error in our error string then we show
' the error message o/w we proceed with the insert.
If strErrorMsg <> "" Then
' Show the error message that got us here!
Response.Write strErrorMsg
' Open connection to the DB
Set cnnFormToDB =3D Server.CreateObject("ADODB.Connection")
cnnFormToDB.Open strConnString

' Build our SQL String
strSQL =3D ""
strSQL =3D strSQL & "INSERT INTO scratch "
strSQL =3D strSQL & "(text_field, integer_field, date_time_field) " & =
strSQL =3D strSQL & "VALUES ("
strSQL =3D strSQL & "'" & strTextField & "'"
strSQL =3D strSQL & ", "
strSQL =3D strSQL & intIntegerField
strSQL =3D strSQL & ", "
strSQL =3D strSQL & ");"

' Execute the SQL command. I pass it a variable lngRecsAffected
' in which to return the number of records affected. I also tell
' it that this is a text command and it won't be returing any
' records... this helps it execute the script faster!
' And before you ask... I don't know, but YES IT IS OR!!!
cnnFormToDB.Execute strSQL, lngRecsAffected, adCmdText Or =

' Dispose of the CONN object
Set cnnFormToDB =3D Nothing
' Display a verification message and we're done!
<h2>Thanks for submitting your information to us!</h2>
<strong>The resulting SQL statement was:</strong>
<pre><%=3D strSQL %></pre>
<strong>Number of records affected:</strong> <%=3D lngRecsAffected %>
End If
End If



These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Internet Database

Visually create Web enabled database applications in minutes.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by  and YesSoftware, Inc.