The database insert failed. Data type mismatch in criteria expression.

W

Wayne

Hello All;
(WinNT4 / IIS4 / Access 2000 )

I am receiving this error, and it is driving me nuts.
I am going to list everything that I have done already.

===========================================
The ASP Scripts are from templates that I have.
I am running the scripts on several different e-commerce sites already.
They work great and without flaw.

I am designing a Music Site with the Scripts now.
And the basic Admin-Layout is the same in all, except I add
In what is needed for what "Table.Fields" that are needed and created.

I have been doing this for the last 4 years and have built other's outside
of our
Company shops with the same script, and this Error
[ The database insert failed. Data type mismatch in criteria expression.]
Has never ever popped up before, the other day.

-------------------------
I have recreated the actual page 2-times.
I have Recreated the Database (From the original working database) once.
-------------------------

The original Table.Fields, when I submit a new record the page does what it
needs to do,
Without a bother. But when I update the page and edit the "New Fields" in
the page.
And [Submit] to the database, I receive the error.
Never feels.

--------------------
I read that it has something to do with the "Time/Date" and having a blank
entry ""
But this is not the case with my issue, but instead, it will do it with a
Text , Memo & Number field.

I thought at first that maybe it was the names of the fields, that could
have
Been causing the problem, but that was incorrect. The Field.Names are:

FArtist
FAmount
FImage
FArtImage
FItemNumber
And so on......... All beginning with the letter "F"
===========================================

Any idea's on this, and on what I can do please let me know.

Thank you for anything.
Wayne
 
D

Douglas J. Steele

What do your tables look like, and what's the actual SQL you're trying to
run?
 
W

Wayne

Hello "Douglas J. Steele"

Not sure about what you mean about the Table, and what they look like, If
you can
Exaplain that a little better that would be helpful in me giving you the
proper information.

Here is a sniplet of the code that is being used.

=============================================
sub db_insert_edit_Content
sql = "INSERT INTO Content" & _
"(" & _
"DateAdded," & _
"ShortDesc," & _
"LongDesc," & _
"FMetaDesc," & _
"FKeywords," & _
"Expire," & _
") VALUES (" & _
"" & to_sql(now(),"date") & "," & _
"" & to_sql(ShortDesc,"text") & "," & _
"" & to_sql(LongDesc,"text") & "," & _
"" & to_sql(FMetaDesc,"text") & "," & _
"" & to_sql(FKeywords,"text") & "," & _
"" & to_sql(Expire,"date") & "," & _
"3," & _
"0," & _
"0," & _
"0," & _
"0)" & _
""
'response.write sql
on error resume next
cn.Execute(sql)
if err.Number <> 0 then
b_error = true
error_list.add "db_insert_edit_Content" & err.Number ,"The
database insert failed. " & err.Description
else
set rs = cn.Execute("SELECT @@IDENTITY")
ContentID = rs(0)
rs.Close
msg_list.add "db_insert_edit_Content","The database insert was
successful." end if
on error goto 0
end sub
=============================================
 
W

Wayne

its fixed YAAAAAAAAAAAAAAAAA

The new Field entires..
i.e. FKeywords, FMetaDesc where located in the wrong places
Inside the Statements.
So I moved the code to run in sequence with how the entries are actually
inserted
Into the Database.

Example: ( This is just to show how the code looked pay attention to the
"Expire" )

-----------This is what it should look like
"" & to_sql(now(),"date") & "," & _
"" & to_sql(ShortDesc,"text") & "," & _
"" & to_sql(LongDesc,"text") & "," & _
"" & to_sql(FMetaDesc,"text") & "," & _
"" & to_sql(FKeywords,"text") & "," & _
"" & to_sql(Expire,"date") & "," & _

----------This is what it did look like
"" & to_sql(now(),"date") & "," & _
"" & to_sql(ShortDesc,"text") & "," & _
"" & to_sql(LongDesc,"text") & "," & _
"" & to_sql(Expire,"date") & "," & _
"" & to_sql(FMetaDesc,"text") & "," & _
"" & to_sql(FKeywords,"text") & "," & _


Once I corrected these areas, and moved all the calls to their corrosponding
areas.
It works like a charm again..

Something to add to my KB.

Take Care All
Wayne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top