|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
passing a list as a variable
I would love any assistance that anyone could provide. I have a list box that the user can select multiple Apartment Communities. their value are tied to the AutoNumber, Cust_ID field in the DB. I need to be able to pass this list of multiple values through a variable to a new page that will query the database for the Apartment Communities that match the Cust ID variable list, output in some format, I am not sure what I want the page to look yet, but I do know that it will be outputted as email
HELP!!!!!!!!! Thanks, Andy |
|
#2
|
|||
|
|||
|
You list box values will be submitted as a comma separated value to your form action page. So to get the result from your db, you can do something like this
select.. from yourtable where custid in (#form.yourselectboxname#) Hope it helps |
|
#3
|
|||
|
|||
|
I tried that and the error I got was:
Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. The error occurred in C:\CFusionMX\wwwroot\LeasingSolutionsInc\emailconfirm.cfm: line 7 5 : 6 : <cfquery name="ApartmentQuery" datasource="LeasingSolution_Big_DB"> 7 : SELECT * FROM Apartment_Communities_ProductionDB WHERE Cust_ID IN (#CustID#) 8 : </cfquery> 9 : <cfquery name="NameandEmail" datasource="LeasingSolution_Big_DB"> -------------------------------------------------------------------------------- SQL SELECT * FROM Apartment_Communities_ProductionDB WHERE Cust_ID IN (1) DATASOURCE LeasingSolution_Big_DB VENDORERRORCODE -3010 SQLSTATE 07002 The relevant emailconfirm.cfm code is : <cfparam name="URL.CustID" default="1"> <cfparam name="URL.Person_to_Email" default="1"> <cfparam name="FORM.Person_to_Email" default="1"> <cfquery name="ApartmentQuery" datasource="LeasingSolution_Big_DB"> SELECT * FROM Apartment_Communities_ProductionDB WHERE Cust_ID IN #FORM.CustID# </cfquery> <cfquery name="NameandEmail" datasource="LeasingSolution_Big_DB"> SELECT * FROM Potential_Customer_Table WHERE Cust_ID = #FORM.Person_to_Email_to# </cfquery> any Ideas? |
|
#4
|
|||
|
|||
|
Quote:
If I add the () around the Form.CustID variable I get Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. The error occurred in C:\CFusionMX\wwwroot\LeasingSolutionsInc\emailconfirm.cfm: line 7 5 : 6 : <cfquery name="ApartmentQuery" datasource="LeasingSolution_Big_DB"> 7 : SELECT * FROM Apartment_Communities_ProductionDB WHERE Cust_ID IN (#FORM.CustID#) 8 : </cfquery> 9 : <cfquery name="NameandEmail" datasource="LeasingSolution_Big_DB"> -------------------------------------------------------------------------------- SQL SELECT * FROM Apartment_Communities_ProductionDB WHERE Cust_ID IN (60,62,59) DATASOURCE LeasingSolution_Big_DB VENDORERRORCODE -3010 SQLSTATE 07002 Please try the following: |
|
#5
|
|||
|
|||
|
If customer ID is not a numeric field, you'll need to put single quotes around EACH of the elements in your IN clause. You can look into the listQualify() function or maybe listChangeDelims().
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#6
|
|||
|
|||
|
Quote:
Thanks for the help kiteless- As it turns out my problem was not what I thought it was, it was the fact that I am a mental midget and I didn't have my custId variable passed properly. thanks again though for your time |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > passing a list as a variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|