Link to home
Start Free TrialLog in
Avatar of slegy
slegy

asked on

ODBC Drivers error '80040e21' - Invalid Precision Value

There has to be something very simple that I am missing. I created a form to add records to an Access database (2007). To perform the update I added a Server Behavior: Insert Record(form "addEvent").  All of the insert code hasbeen generated by Dreamweaver. Everything matched up and looked good. When I first ran a test I received the 80040e21 error. I went back and checked and found some mismatched data types, which I corrected. Ran another test and got the same error. So I created a test form with only two fields, with the idea that I could zero in on the offending field. But I'm getting the same error with just two text fields:

Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

[Microsoft][ODBC Microsoft Access Driver]Invalid precision value

/ilca/racing/calendar/addEvent2.asp, line 26
Line 26: MM_editCmd.Execute

What am I overlooking? I've read through other related postings, and they were dealing with much more complicated forms.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include virtual="/ilca/Connections/eventCalendar.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
 
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "addEvent") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
 
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_eventCalendar_STRING
    MM_editCmd.CommandText = "INSERT INTO eventCalendar (eventTitle, [eventTitle-long]) VALUES (?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, -1, Request.Form("eventTitle")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 100, Request.Form("eventTitle-long")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
  End If
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- InstanceBegin template="/Templates/mainLayout.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Welcome to the International Lightning Class</title>
<!-- InstanceEndEditable -->
<script src="../../scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<link href="../../css/mainLayout.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../../css/navMenu.css" />
<!-- InstanceBeginEditable name="styles" -->
<link href="/ilca/css/eventUpdate.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style5 {
	font-size: 12px
}
.style6 {color: #990000}
.style8 {color: #990000; font-size: 10px; }
.style10 {color: #990000; font-weight: bold; }
-->
</style>
<!-- InstanceEndEditable --><!-- InstanceParam name="setdatetype" type="text" value="" -->
</head>
<body onload="">
<p>&nbsp;</p>
<div id="wrapper">
  <div id="header"> <!-- InstanceBeginEditable name="globe" --><!-- InstanceEndEditable --> <a href="../../assets/media/rotatingGlobe.swf">
    <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','72','height','72','title','Rotating Globe','src','/ilca/assets/media/rotatingGlobe','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','/ilca/assets/media/rotatingGlobe' ); //end AC code
    </script>
    <noscript>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="72" height="72" title="Rotating Globe">
      <param name="movie" value="/ilca/assets/media/rotatingGlobe.swf" />
      <param name="quality" value="high" />
      <param name="wmode" value="transparent" />
      <embed src="/ilca/assets/media/rotatingGlobe.swf" width="72" height="72" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
    </object>
    </noscript>
    </a><a href="/ilca/index.asp"><img src="/ilca/assets/images/mainTemplate/headerImg.png" width="500" height="74" border="0" /></a></div>
  <div id="sidebar">
    <div id="navigation">
      <!-- menu script itself. you should not modify this file -->
      <script type="text/javascript" language="JavaScript" src="/ilca//scripts/navMenu.js"></script>
      <!-- items structure. menu hierarchy and links are stored there -->
      <script type="text/javascript" language="JavaScript" src="/ilca/scripts/navMenu_items.js"></script>
      <!-- files with geometry and styles structures -->
      <script type="text/javascript" language="JavaScript" src="/ilca/scripts/navMenu_tpl.js"></script>
      <script type="text/javascript" language="javascript">
	<!--//
	// Make sure the menu initialization is right above the closing &lt;/body&gt; tag
	// Moving it inside other tags will not affect the position of the menu on
	// the page. If you need this feature please consider Tigra Menu GOLD.
 
	// each menu gets two parameters (see demo files)
	// 1. items structure
	// 2. geometry structure
 
	new menu (MENU_ITEMS, MENU_TPL);
 
	// If you don't see the menu then check JavaScript console of the browser for the error messages
	// "Variable is not defined" error indicates that there's syntax error in that variable's definition
	// or the file with that variable isn't properly linked to the HTML document
	//-->
</script>
    </div>
    <div id="sbar-image1"><img src="/ilca/assets/images/mainTemplate/70thSticker.png" alt="Lightning Class 70th Anniversary" width="90" height="90" /></div>
    <div id="sbar-news">
      <h1>&nbsp;</h1>
      <p>&nbsp;</p>
    </div>
    <div id="sbar-image2"><a href="/ilca/membership/joinRenew/membershipOptions.asp"><img src="/ilca/assets/images/mainTemplate/join.png" alt="Join the ILCA" width="89" height="72" border="0" /></a></div>
    <div id="sbar-search"><img src="../../assets/images/mainTemplate/search.png" alt="Search the Site" /> </div>
  </div>
  <!-- InstanceBeginEditable name="mainContent" -->
  <div id="mainContent">
    <div align="center">
      <h3><br />
        Add an Event to the ILCA Calendar</h3>
      <h3><br />
      </h3>
    </div>
    <form ACTION="<%=MM_editAction%>" METHOD="POST" name="addEvent">
      <fieldset id="eventInfo">
      <legend class="eventlegend style5">Event Information – * Indicates required fields</legend>
        <div id="event"><span class="style10">*</span>Event Title:
          <label for="mailfrom"></label>
          <input name="eventTitle" type="text" id="eventTitle" tabindex="8" size="42"  maxlength="42" />
          <span class="style8">Maximum 42 characters</span><br />
          <label for="eventTitle-long"></label>
          <label for="mailfrom">Event Title-Long:</label>
          <input name="eventTitle-long" type="text" id="eventTitle-long" tabindex="8" size="100"  maxlength="100" />
      </div>
      </fieldset>
      <p>
        <label for="submit"></label>
        <input type="submit" name="submit" id="submit" value="Submit" />
      </p>
      <p>&nbsp; </p>
      
    
      <input type="hidden" name="MM_insert" value="addEvent" />
    </form>
  </div>
  <!-- InstanceEndEditable -->
  <div id="clear"></div>
  <div id="footer">
    <p><u>Membership</u> | <u>Racing</u> | <u>Class Rules</u> | <u>Photo Gallery</u> | <u>Marketplace</u> | <u>Contacts</u> | <u>Site Map</u><br />
      All Rights Reserved—International Lightning Class Association</p>
    <p></a><u>office@lightningclass.org</u></p>
    <p>7625 South Yampa Street, Centennial, Colorado 80016 — Phone: 303-325-5886 — Fax: 303-699-2178 — Skype: ilcaoffice</p>
  </div>
</div>
</body>
<!-- InstanceEnd -->
</html>
<%
rseventCalendar.Close()
Set rseventCalendar = Nothing
%>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of slegy
slegy

ASKER

Fantastic! It worked the first time I made the change. I'd tried to research it, but all I found were discussions about mismatched data types. This does not seem to reflect well on Dreamweaver. Most of the fields were the exact right size, but there were several -1s.  Would you mind sharing where you found the answer.

Thank you, thank you.
>> This does not seem to reflect well on Dreamweaver.

True, although I must admit I've not seen this error before.


>> Would you mind sharing where you found the answer

The answer I figured out from this page.
http://support.microsoft.com/kb/132960

It seems that specifying a field size of -1 in the code should make the code work, but it does say that -1 reverts to a 'default size value', which makes me think it actually won't work if your database fields are a non-standard size.