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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QUeries don't match field distribution

Status
Not open for further replies.

Shlomo

IS-IT--Management
May 11, 2000
28
US
I'm getting a mesaage that the insert into I entered is invalid due to a mismatch between queries and field distributions.&nbsp;&nbsp;I checked all the fields in the values part of the statement against the list on the insert into part of the statement and they are the same and in the same order.&nbsp;&nbsp;<br><br>What else might cause this error?
 
I had this same problem with an Access database.&nbsp;&nbsp;It turned out I was using the word &quot;Date&quot; as a column name.&nbsp;&nbsp;Access handled this fine &lt;u&gt;within Access&lt;/u&gt;, but not from my CF Query.&nbsp;&nbsp;I changed the name of the column and everything was fine.&nbsp;&nbsp;Is it possible you're using a reserved word for a column name?<br><br>Also, it is possible that you are having problems with your single quotes. (Either forgetting to use them with a string or using them with a numerical value) Try checking the format of your columns.&nbsp;&nbsp;I have also inadvertently configured text columns as integers and vice-versa..:)<br><br>Hope this helps,<br>DM
 
date is a reserved word in sql. with access it's fine you would have to put brackets around it [date] for CF.. I had the same problem with the column title Section.
 
Thank you for your suggestion.&nbsp;&nbsp;There are no keywords being used, however.&nbsp;&nbsp;( Unless lastOrderDate is considered a keyword!!) <br>
 
Sorry, no solutions here, but is your SQL hardcoded in your page or is it in someway depending on user input? <br><br>I've had the same kind of problem when I tried to create a page where a user could type his own SQL in a textarea tag also using an Access db. It worked fine on simple SELECT queries but gave the same sort of errors on INSERT or UPDATE queries, all of which worked fine when hardcoded in the page. <br><br>Since I was just playing around with some ideas I had and it wasn't anything important (or even productive :) I just let it go, but I'd be interested to know if this is a common problem.<br><br>Again sorry for the lack of simple solutions but maybe it helps a little to know you're not alone :)<br><br>Cheers,<br><br>Bromrrrr
 
I have the same problem about date mismatch.<br>when i tried to make update function. it always shows erro unless i fill all forms where is date format. I have already set required=&quot;no&quot; in both cfm file and access. the form still didn't allow me leave empty in any dateformat place to finish the update. but i can leave empty in textformat place. strange.<br><br>file 1::<br>&lt;cfquery..<br>select *<br>from....<br><br>&lt;cfform action=&quot;file2.cfm....<br>&lt;cfinput type=&quot;text&quot; value=#dateformat(last, &quot;mm/dd/yyyy&quot;)# name=&quot;last&quot; required=&quot;no&quot;&gt;<br>&lt;cfinput type=&quot;text&quot; value=#dateformat(next, &quot;mm/dd/yyyy&quot;)# name=&quot;next&quot; required=&quot;no&quot;&gt;...<br><br>file2::<br>&lt;cfquery..<br>update..<br>set last='#last#',<br>next='#next#',<br>.....<br><br><br>
 
achai -<br>Try this:<br><FONT FACE=monospace><br>update table<br>set last='#dateformat(last,&quot;mm/dd/yyyy&quot;)# #timeformat(last,&quot;HH:mm:ss&quot;)#',<br>next='#dateformat(next,&quot;mm/dd/yyyy&quot;)# #timeformat(next,&quot;HH:mm:ss&quot;)#'<br></font>
 
still haven't resolved the problem.<br>erro is &quot;Data type mismatch in criteria expression&quot;<br>text form doesn't need to fill in all of them. but date form can't be left empty.
 
You should probably output the #last# and #next# variables while debugging so you can see what exactly is being passed to the database...&nbsp;&nbsp;This should give you a good idea how to process them...&nbsp;&nbsp;Sorry my suggestion didn't work :-( <br><br>DM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top