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

Multiple Select Error

Status
Not open for further replies.

jenmer

Technical User
Jan 2, 2007
7
IE
Hi

I am using a query below for a multiple select and it is giving me the error below. I am supposed to use the IN statement below but it still is giving me this error. I have been at this for days and it's driving me mad.


<select multiple="multiple" name="mbasectorid">
<option value="">All</option>
<cfloop query="qMBASectorSelect">
<option value="#qMBASectorSelect.MBASECTORid#"
<cfif qMBASectorSelect.MBASECTORid eq form.mbasectorid>
selected
</cfif>
>#qMBASectorSelect.MBASECTORName#</option>
</cfloop>
</select>


<cfquery name="qCVBookSelect" datasource="#request.dsName#">
select CVBook.CVBookID ,
CVBook.MBASectorID ,
MBASector.MBASectorName ,
:
:

from CVBook
left join MBASector on MBASector.MBASectorID = CVBook.MBASectorID


where 1 = 1

<cfif form.mBASectorID eq "">
and
mBASectorID in (#ListQualify(Form.mbasectorid,"'")#) </cfif>
</cfquery>

Error:
[Macromedia][SQLServer JDBC Driver][SQLServer]Syntax error converting the varchar value '1,2,3' to a column of data type int.

I would really appreciate anyones help.

Jennifer
 
Jennifer,

give this a go:

Code:
and mBASectorID in (<cfqueryparam cfsqltype="cf_sql_integer" value="#Form.mbasectorid#" list="Yes">)

hope this helps!

Tony
 
Hi
Thanks for sending me on a reply unfortunatly I tried the code and gives the same error??

Any other ideas?

Jennifer
 
Jennifer

What error are you getting now? the same one?

Can you do a dump of the data within Form.mbasectorid

Tony
 
I still get the same error.. but after all of this it wasnt down to the code it was the database at fault. Thanks for your help. Just wished i had found this out last week not to waste so much time on it..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top