CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> Archive -> CodeCharge.Discussion

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

Print topic Send  topic

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

This is a multi-part message in MIME format.

------=_NextPart_000_0015_01C3C423.0DC50120
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0016_01C3C423.0DC50120"


------=_NextPart_001_0016_01C3C423.0DC50120
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,=20

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:
http://support.codecharge.com/kb_article.asp?article_id=3D4

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,

Razvan
------=_NextPart_001_0016_01C3C423.0DC50120
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<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
154</FONT></DIV>
<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 =
href=3D"http://support.codecharge.com/kb_article.asp?article_id=3D4"><FON=
T=20
face=3DArial=20
size=3D2>http://support.codecharge.com/kb_article.asp?article_id=3D4</FON=
T></A></DIV>
<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 =
that=20
didn't work either. I believe I'm using IIS 4 or IIS 5 but I'm not sure. =
The=20
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 =
work.</FONT></DIV>
<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>

------=_NextPart_001_0016_01C3C423.0DC50120--

------=_NextPart_000_0015_01C3C423.0DC50120
Content-Type: application/octet-stream;
name="form_to_db.asp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="form_to_db.asp"

<%
' 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"adovbs.inc" -->
<%



' *** 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") & ";"
=09
' 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.
Const DATE_DELIMITER =3D "#"




' *** 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") %>" =
method=3D"post">
<input type=3D"hidden" name=3D"action" value=3D"Save Form Data" />
<table border=3D"0">
<tr>
<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>
</tr>
<tr>
<td align=3D"right"><strong>Integer Field:</strong></td>
<td align=3D"left"><input type=3D"text" name=3D"integer_field" /></td>
</tr>
<tr>
<td align=3D"right"><strong>Date/Time Field:</strong></td>
<td align=3D"left"><input type=3D"text" name=3D"date_time_field" =
/></td>
</tr>
<tr>
<td> </td>
<td>
<input type=3D"reset" value=3D"Clear" />
<input type=3D"submit" value=3D"Save" />
</td>
</tr>
</table>
</form>
<%
Else
' 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 ""
=09
' 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
=09
strTextField =3D Replace(strTextField, "'", "''")
intIntegerField =3D Replace(intIntegerField, "'", "''")
datDateTimeField =3D Replace(datDateTimeField, "'", "''")
=09
If Err.number <> 0 Then
strErrorMsg =3D strErrorMsg & "Your entry for string_field is " & _
"inappropriate!<br />" & vbCrLf
Err.Clear
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
Err.Clear
End If =09
=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
Err.Clear
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
Else
' 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) " & =
vbCrLf
strSQL =3D strSQL & "VALUES ("
strSQL =3D strSQL & "'" & strTextField & "'"
strSQL =3D strSQL & ", "
strSQL =3D strSQL & intIntegerField
strSQL =3D strSQL & ", "
strSQL =3D strSQL & DATE_DELIMITER & datDateTimeField & DATE_DELIMITER
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 =
adExecuteNoRecords

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

------=_NextPart_000_0015_01C3C423.0DC50120--

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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