By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,659 Members | 940 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,659 IT Pros & Developers. It's quick & easy.

Type mismatch

P: 11
Hi guys,

Im trying to create a page using SQL and ASP. The SQL was working correctly untill I tried to introduce the use of variables so that I could grab two variables from two text boxes, and include them as a WHERE clause in the SQL as a numerical range.

Since doing this, I get the following error...

Type mismatch: '[string:"SELECT table.fieldname"]'

the error indicates a problem with line 48 which is where the SQL is executed.

<%SQL="SELECT table.fieldname1, table.fieldname2, table.fieldname3, table.fieldname4, table.fieldname5, table.fieldname6, table.fieldname7 FROM table1, table2 WHERE table1.fieldname IsBetween " & request.form("minrange") AND request.form("maxrange") &" AND table1.fieldname8=table2.fieldname8 ORDER BY table2.fieldname1, table2.fieldname2"%>

anyone see whether there is a syntax error there? or do you need the rest of the code?

Feb 26 '07 #1
Share this Question
Share on Google+
6 Replies

Expert 100+
P: 692

is there any function like isBetween in SQL? I don't know?
You may be getting error there.
Feb 26 '07 #2

P: 11
Changed isBetween, to Between, It made no difference.


Feb 26 '07 #3

Expert 100+
P: 692

Even to Between is not a valid function.IsBetween is in Oracle not in Sql my guess.

Can you try simply saying this

table1.fieldname >= " & request.form("minrange") AND table1.fieldname <= request.form("maxrange")
Feb 26 '07 #4

P: 11
ok, so the code now reads...

WHERE table.fieldname >= " & request.form("minrange") & " AND table.fieldname <= " & request.form("maxrange") & " ORDER BY table.fieldname, table.fieldname"%>

the error has now changed...

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

[Informix][Informix ODBC Driver][Informix]A syntax error has occurred.


Feb 26 '07 #5

Expert 2.5K+
P: 3,405
I hope I'm not just demonstrating my ignorance, but I bet this is the simple kind of problem we all get when we stare at a problem too long. Whenever I have this problem, which is more often than I like to admit, I usually find it is a stupid mistake on my part. To solve it, I usually first add a line:
Expand|Select|Wrap|Line Numbers
  1. response.write "<!-- " & query & " -->" & vbNewLine
right before I execute the query. This should be printed after the query is constructed, but before the error is generated. If I look over the query printed, I usually figure out where it went wrong.

The second thing I do to troubleshoot is separate each segment of the query statement onto a new line, and comment each line out in turn until I find which line is causing the problem. Believe it or not, I usually find that the problem is something very simple, not necessarily what I thought it was when I started.
Feb 26 '07 #6

P: 11
Issue now resolved
Mar 26 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.