Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
maderacr
Starting Member
3 Posts |
Posted - 2005-11-09 : 23:08:12
|
Having the following info:Table Store_Informationstore_name Sales Date Los Angeles $1500 Jan-05-1999 San Diego $250 Jan-07-1999 San Francisco $300 Jan-08-1999 Boston $700 Jan-08-1999 we key in,SELECT *FROM Store_InformationWHERE store_name IN ('Los Angeles', 'San Diego')Result:store_name Sales Date Los Angeles $1500 Jan-05-1999 San Diego $250 Jan-07-1999 If I change ('Los Angeles' 'San Diego') to [City] get no resultsSELECT *FROM Store_InformationWHERE store_name IN [City]Result:Has anybody had this problem ? |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-10 : 00:48:54
|
What does City have?MadhivananFailing to plan is Planning to fail |
 |
|
maderacr
Starting Member
3 Posts |
Posted - 2005-11-10 : 06:34:41
|
[City] is a Parameter, in this case it will wait for input. I tried all the following with no luck: ('Los Angeles', 'San Diego'), ("Los Angeles", "San Diego"), (Los Angeles, San Diego), Los Angeles, San Diego. It only worked with one Parameter, if I sent Los Angeles no other options, or if I sent San Diego No other options it would select the one parameter I sent, but not both. |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-10 : 06:57:18
|
You need to make use of Command objects to pass the parameter values to that queryHow many parameters did you use?MadhivananFailing to plan is Planning to fail |
 |
|
maderacr
Starting Member
3 Posts |
Posted - 2005-11-10 : 11:10:16
|
The only Parameter is the [City], it will pop up a message box asking for the city. If I only type in 1 City it will work, if I try more than 1 city in the paramter it will not work. How would I use commands to pass the parameter ? |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-11 : 00:46:32
|
Then you need to make a query like thisSELECT *FROM Store_InformationWHERE store_name =? or store_name =? Now you will be popped up to enter two namesMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|