User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 373,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,943 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser:
Views: 5292 | Replies: 17
Reply
Join Date: Apr 2007
Posts: 28
Reputation: lafalot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
lafalot lafalot is offline Offline
Light Poster

Help MS Access Error - sometimes

  #1  
Apr 11th, 2007
I have a form on our Web site where visitors enter data. I use cfinsert to insert this data into an MS access table.

Most of the time, this form works. However, I occassionally get the following error: Error Executing Database Query. Application uses a value of the wrong type for the current operation.

I am unable to duplicate the error myself, and have no idea why I only get this error sporadically.

Any ideas?

Thank you!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Posts: 28
Reputation: cfAllie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cfAllie cfAllie is offline Offline
Light Poster

Re: MS Access Error - sometimes

  #2  
Apr 11th, 2007
I don't know what version you're using but you might look at http://www.adobe.com/cfusion/knowled...fm?id=tn_18952

You might also consider converting the cfinsert to a regular insert statement

<cfquery ...>
INSERT INTO YourTable (Columns..)
VALUES (....)
</cfquery>
Reply With Quote  
Join Date: Apr 2007
Posts: 28
Reputation: lafalot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
lafalot lafalot is offline Offline
Light Poster

lafalot

  #3  
Apr 11th, 2007
Originally Posted by cfAllie View Post
I don't know what version you're using but you might look at http://www.adobe.com/cfusion/knowled...fm?id=tn_18952

You might also consider converting the cfinsert to a regular insert statement

<cfquery ...>
INSERT INTO YourTable (Columns..)
VALUES (....)
</cfquery>


Thank you, cfAllie. I'm using MX7.

I'm not sure if I want to use the insert statement, because none of my form fields are required, and if they are not filled out, I get Element formfield is undefined in FORM errors.

There are a lot of fields on the form, so cfinsert just seemed like the better solution.
Reply With Quote  
Join Date: Mar 2007
Posts: 28
Reputation: cfAllie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cfAllie cfAllie is offline Offline
Light Poster

Re: lafalot

  #4  
Apr 11th, 2007
Originally Posted by lafalot View Post
Thank you, cfAllie. I'm using MX7.

I'm not sure if I want to use the insert statement, because none of my form fields are required, and if they are not filled out, I get Element formfield is undefined in FORM errors.

There are a lot of fields on the form, so cfinsert just seemed like the better solution.


I understand. The problem with cfinsert is that when it works, it works well.. but when it doesn't work its a lot tougher to debug. I use regular inserts with optional fields all the time. I prefer it.

Is it possible the problem is related to the size of the values inserted? That might explain the sporadic nature of the error. If possible can you post the table structure and database type?
Reply With Quote  
Join Date: Mar 2007
Posts: 28
Reputation: cfAllie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cfAllie cfAllie is offline Offline
Light Poster

Re: MS Access Error - sometimes

  #5  
Apr 11th, 2007
Sorry, I meant which "datasource" type Is it Access or Access with Unicode?
Reply With Quote  
Join Date: Apr 2007
Posts: 28
Reputation: lafalot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
lafalot lafalot is offline Offline
Light Poster

Re: MS Access Error - sometimes

  #6  
Apr 11th, 2007
It's MS Access with Unicode. The table is huge, so I don't know if I'll post the structure. However, I did put a MAXLENGTH on all form fields to make sure that they couldn't enter too much data. I also have some hidden form fields that include a date, but since it works so much of the time, I don't see how that could be the problem.
Reply With Quote  
Join Date: Mar 2007
Posts: 28
Reputation: cfAllie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cfAllie cfAllie is offline Offline
Light Poster

Re: MS Access Error - sometimes

  #7  
Apr 11th, 2007
Do you have any memo fields? I was able to reproduce the error using a simple table with a memo field like below. I don't remember the limits for the unicode driver.

Table1
ID Autonumber
Name Text 50
Notes Memo

Datasource
Microsoft Access with Unicode
CLOB (Checked)
Long Text Buffer (64000)

<cfset form.name = "Alan">
<cfset form.notes = "">
<cfloop from="1" to="640" index="x">
<cfset form.notes = listAppend(form.notes, "0123456789")>
</cfloop>

<cfoutput>#Len(form.notes)#</cfoutput>
<cfinsert datasource="AccessUnicodeDSN" tablename="Table1" formfields="Name,Notes">
Reply With Quote  
Join Date: Apr 2007
Posts: 28
Reputation: lafalot is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
lafalot lafalot is offline Offline
Light Poster

Re: MS Access Error - sometimes

  #8  
Apr 11th, 2007
Thank you so much for trying to help me!

Nope, no memo fields. And I've tried the form myself, entering all kinds of values of varying sizes, and everything works. Is there a way to get the name of the field that is causing the error?
Reply With Quote  
Join Date: Mar 2007
Posts: 28
Reputation: cfAllie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cfAllie cfAllie is offline Offline
Light Poster

Re: MS Access Error - sometimes

  #9  
Apr 11th, 2007
Strangely the same values work with a regular insert.

<cfquery name="InsertRow" datasource="AccessUnicodeDSN">
INSERT INTO Table1 (Name, Notes)
VALUES
(
<cfqueryparam value="#form.Name#" cfsqltype="cf_sql_varchar" null="#not len(form.Name)#">,
<cfqueryparam value="#form.Notes#" cfsqltype="cf_sql_clob" null="#not len(form.notes)#">
)
</cfquery>
Reply With Quote  
Join Date: Mar 2007
Posts: 28
Reputation: cfAllie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cfAllie cfAllie is offline Offline
Light Poster

Re: MS Access Error - sometimes

  #10  
Apr 11th, 2007
Originally Posted by lafalot View Post
Thank you so much for trying to help me!

Nope, no memo fields. And I've tried the form myself, entering all kinds of values of varying sizes, and everything works. Is there a way to get the name of the field that is causing the error?


Unfortunately, I've never heard of that error occuring except with memo fields.

I don't know. I have full debugging turned on and I can't see the sql statement sent to the database. Do you check your logs to see if they contain any more information?

You probably tried this but ... did you use values that you know are invalid for certain field types. Like if the max length is 50 did you try entering a value that is 100 characters long? Have you tried switching to the regular Access driver? Assuming you don't need Unicode support.
Last edited by cfAllie : Apr 11th, 2007 at 7:47 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ColdFusion Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ColdFusion Forum

All times are GMT -4. The time now is 6:25 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC