[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
am 09.03.2005 00:18:15 von SteveB
I get this whenver I try to add a book to the database
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
/book_add.asp, line 110
Now for the snippet from book_ad.asp where the errror is generated
<%
if trim(Request.Form("cat")) = "" then
Response.Redirect("book.asp")
else
cat = cLng(Request.Form("cat"))
end if
title = replace(ChkString(Request.Form("title"),"title"), "''","'", 1,
-1, 1)
summary =
replace(ChkString(ChkBadWords(Request.Form("summary")),"mess age"),
"''","'", 1, -1, 1)
key = replace(ChkString(Request.Form("key"),"message"), "''","'", 1, -1,
1)
author = replace(ChkString(Request.Form("author"),"title"), "''","'", 1,
-1, 1)
poster = replace(ChkString(Request.Form("poster"),"title"), "''","'", 1,
-1, 1)
today = datetostr(strForumTimeAdjust)
strSQL = "SELECT CAT_ID FROM BOOK_SUBCATEGORIES WHERE BSUBCAT_ID = " &
cat
dim rsCategories
set rsCategories = server.CreateObject("adodb.recordset")
rsCategories.Open strSQL, my_Conn
parent = rsCategories("CAT_ID")
rsCategories.Close
set rsCategories = nothing
sString = ""
if len(trim(title)) = 0 then
sString = sString & "
Please enter book title."
else
Set RS=Server.CreateObject("ADODB.Recordset")
strSql="Select TITLE from BOOK where TITLE='" & chkString(title,
"SQLString") & "'"
RS.Open strSql, my_Conn
if not rs.eof then
sString = sString & "This book already exists in our database."
end if
RS.close
end if
if cat = "--Please select one--" then
sString = sString & "Please select category that match your
book."
end if
if len(trim(summary)) = 0 then
sString = sString & "Please enter book summary."
end if
if len(trim(summary)) => 400 then
sString = sString & "" &len(trim(summary))&" characters. Your
summary is too long! 400 characters max."
end if
if sString = "" then
strSql = "INSERT INTO BOOK"
strSql = strSql & "(TITLE"
strSql = strSql & ", KEYWORD"
strSql = strSql & ", CATEGORY"
strSql = strSql & ", SUMMARY"
strSql = strSql & ", POST_DATE"
strSql = strSql & ", PARENT_ID"
strSql = strSql & ", SHOW"
strSql = strSql & ", HIT "
strSql = strSql & ", AUTHOR"
strSql = strSql & ", MEMBER_ID"
strSql = strSql & ") "
strSql = strSql & " VALUES ("
strSql = strSql & "'" & replace(chkString(title, "SQLString"), "''","'",
1, -1, 1) & "'"
strSql = strSql & ", " & "'" & chkString(key, "SQLString") & "'"
strSql = strSql & ", " & "'" & cat & "'"
strSql = strSql & ", " & "'" & chkString(summary, "SQLString") & "'"
strSql = strSql & ", " & "'" & today & "'"
strSql = strSql & ", " & "'" & parent & "'"
if mlev=4 then
strSql = strSql & ", " & "1"
else
strSql = strSql & ", " & "0"
end if
strSql = strSql & ", " & "0"
strSql = strSql & ", " & "'" & chkString(author, "SQLString") & "'"
strSql = strSql & ", " & "'" & chkString(strUserMemberID, "SQLString") &
"'"
strSql = strSql & ")"
my_Conn.Execute (strSQL)
Line number 110 is the line above^^^^^^^^
Any thoughts?
This was originally used on a SQL database and I am using this on access
database.
Any thoughts on what could be wrong?
Thanks in advance
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Re: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
am 09.03.2005 01:30:16 von ten.xoc
So we can have some clue what you're talking about, please do two things
(debugging 101):
(a) list the names and datatypes of the columns in the BOOK table.
(b) change my_Conn.Execute (strSQL) to Response.Write(strSQL) and tell us
what that yields.
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Sunshyne Video" wrote in message
news:#bkzbUDJFHA.2704@tk2msftngp13.phx.gbl...
>
>
>
> I get this whenver I try to add a book to the database
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
>
> [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
> expression.
>
> /book_add.asp, line 110
>
>
> Now for the snippet from book_ad.asp where the errror is generated
>
>
>
>
> <%
> if trim(Request.Form("cat")) = "" then
> Response.Redirect("book.asp")
> else
> cat = cLng(Request.Form("cat"))
> end if
> title = replace(ChkString(Request.Form("title"),"title"), "''","'", 1,
> -1, 1)
> summary =
> replace(ChkString(ChkBadWords(Request.Form("summary")),"mess age"),
> "''","'", 1, -1, 1)
> key = replace(ChkString(Request.Form("key"),"message"), "''","'", 1, -1,
> 1)
> author = replace(ChkString(Request.Form("author"),"title"), "''","'", 1,
> -1, 1)
> poster = replace(ChkString(Request.Form("poster"),"title"), "''","'", 1,
> -1, 1)
> today = datetostr(strForumTimeAdjust)
>
> strSQL = "SELECT CAT_ID FROM BOOK_SUBCATEGORIES WHERE BSUBCAT_ID = " &
> cat
> dim rsCategories
> set rsCategories = server.CreateObject("adodb.recordset")
> rsCategories.Open strSQL, my_Conn
> parent = rsCategories("CAT_ID")
> rsCategories.Close
> set rsCategories = nothing
>
>
> sString = ""
>
> if len(trim(title)) = 0 then
> sString = sString & "Please enter book title."
> else
> Set RS=Server.CreateObject("ADODB.Recordset")
>
> strSql="Select TITLE from BOOK where TITLE='" & chkString(title,
> "SQLString") & "'"
> RS.Open strSql, my_Conn
>
> if not rs.eof then
> sString = sString & "This book already exists in our database."
> end if
> RS.close
> end if
>
> if cat = "--Please select one--" then
> sString = sString & "Please select category that match your
> book."
> end if
>
> if len(trim(summary)) = 0 then
> sString = sString & "Please enter book summary."
> end if
>
> if len(trim(summary)) => 400 then
> sString = sString & "" &len(trim(summary))&" characters. Your
> summary is too long! 400 characters max."
> end if
>
> if sString = "" then
>
> strSql = "INSERT INTO BOOK"
> strSql = strSql & "(TITLE"
> strSql = strSql & ", KEYWORD"
> strSql = strSql & ", CATEGORY"
> strSql = strSql & ", SUMMARY"
> strSql = strSql & ", POST_DATE"
> strSql = strSql & ", PARENT_ID"
> strSql = strSql & ", SHOW"
> strSql = strSql & ", HIT "
> strSql = strSql & ", AUTHOR"
> strSql = strSql & ", MEMBER_ID"
> strSql = strSql & ") "
> strSql = strSql & " VALUES ("
> strSql = strSql & "'" & replace(chkString(title, "SQLString"), "''","'",
> 1, -1, 1) & "'"
> strSql = strSql & ", " & "'" & chkString(key, "SQLString") & "'"
> strSql = strSql & ", " & "'" & cat & "'"
> strSql = strSql & ", " & "'" & chkString(summary, "SQLString") & "'"
> strSql = strSql & ", " & "'" & today & "'"
> strSql = strSql & ", " & "'" & parent & "'"
> if mlev=4 then
> strSql = strSql & ", " & "1"
> else
> strSql = strSql & ", " & "0"
> end if
> strSql = strSql & ", " & "0"
> strSql = strSql & ", " & "'" & chkString(author, "SQLString") & "'"
> strSql = strSql & ", " & "'" & chkString(strUserMemberID, "SQLString") &
> "'"
> strSql = strSql & ")"
>
> my_Conn.Execute (strSQL)
>
> Line number 110 is the line above^^^^^^^^
>
> Any thoughts?
>
> This was originally used on a SQL database and I am using this on access
> database.
>
> Any thoughts on what could be wrong?
>
> Thanks in advance
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Re: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
am 09.03.2005 11:15:20 von Tom Loder
Can you output the SQL string strSQL somehow and post the complete SQL
statement that is falling over on line 110 so we can have a look at it!
"Sunshyne Video" wrote in message
news:%23bkzbUDJFHA.2704@tk2msftngp13.phx.gbl...
>
>
>
> I get this whenver I try to add a book to the database
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
>
> [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
> expression.
>
> /book_add.asp, line 110
>
>
> Now for the snippet from book_ad.asp where the errror is generated
>
>
>
>
> <%
> if trim(Request.Form("cat")) = "" then
> Response.Redirect("book.asp")
> else
> cat = cLng(Request.Form("cat"))
> end if
> title = replace(ChkString(Request.Form("title"),"title"), "''","'", 1,
> -1, 1)
> summary =
> replace(ChkString(ChkBadWords(Request.Form("summary")),"mess age"),
> "''","'", 1, -1, 1)
> key = replace(ChkString(Request.Form("key"),"message"), "''","'", 1, -1,
> 1)
> author = replace(ChkString(Request.Form("author"),"title"), "''","'", 1,
> -1, 1)
> poster = replace(ChkString(Request.Form("poster"),"title"), "''","'", 1,
> -1, 1)
> today = datetostr(strForumTimeAdjust)
>
> strSQL = "SELECT CAT_ID FROM BOOK_SUBCATEGORIES WHERE BSUBCAT_ID = " &
> cat
> dim rsCategories
> set rsCategories = server.CreateObject("adodb.recordset")
> rsCategories.Open strSQL, my_Conn
> parent = rsCategories("CAT_ID")
> rsCategories.Close
> set rsCategories = nothing
>
>
> sString = ""
>
> if len(trim(title)) = 0 then
> sString = sString & "Please enter book title."
> else
> Set RS=Server.CreateObject("ADODB.Recordset")
>
> strSql="Select TITLE from BOOK where TITLE='" & chkString(title,
> "SQLString") & "'"
> RS.Open strSql, my_Conn
>
> if not rs.eof then
> sString = sString & "This book already exists in our database."
> end if
> RS.close
> end if
>
> if cat = "--Please select one--" then
> sString = sString & "Please select category that match your
> book."
> end if
>
> if len(trim(summary)) = 0 then
> sString = sString & "Please enter book summary."
> end if
>
> if len(trim(summary)) => 400 then
> sString = sString & "" &len(trim(summary))&" characters. Your
> summary is too long! 400 characters max."
> end if
>
> if sString = "" then
>
> strSql = "INSERT INTO BOOK"
> strSql = strSql & "(TITLE"
> strSql = strSql & ", KEYWORD"
> strSql = strSql & ", CATEGORY"
> strSql = strSql & ", SUMMARY"
> strSql = strSql & ", POST_DATE"
> strSql = strSql & ", PARENT_ID"
> strSql = strSql & ", SHOW"
> strSql = strSql & ", HIT "
> strSql = strSql & ", AUTHOR"
> strSql = strSql & ", MEMBER_ID"
> strSql = strSql & ") "
> strSql = strSql & " VALUES ("
> strSql = strSql & "'" & replace(chkString(title, "SQLString"), "''","'",
> 1, -1, 1) & "'"
> strSql = strSql & ", " & "'" & chkString(key, "SQLString") & "'"
> strSql = strSql & ", " & "'" & cat & "'"
> strSql = strSql & ", " & "'" & chkString(summary, "SQLString") & "'"
> strSql = strSql & ", " & "'" & today & "'"
> strSql = strSql & ", " & "'" & parent & "'"
> if mlev=4 then
> strSql = strSql & ", " & "1"
> else
> strSql = strSql & ", " & "0"
> end if
> strSql = strSql & ", " & "0"
> strSql = strSql & ", " & "'" & chkString(author, "SQLString") & "'"
> strSql = strSql & ", " & "'" & chkString(strUserMemberID, "SQLString") &
> "'"
> strSql = strSql & ")"
>
> my_Conn.Execute (strSQL)
>
> Line number 110 is the line above^^^^^^^^
>
> Any thoughts?
>
> This was originally used on a SQL database and I am using this on access
> database.
>
> Any thoughts on what could be wrong?
>
> Thanks in advance
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!