Home > Archive > Visual Basic > March 2004 > VBScript and an INT column - how to "show all"?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
VBScript and an INT column - how to "show all"?
|
|
| Nathon Jones 2004-03-30, 7:30 pm |
| Hi,
I have a menu, with a list of months. I want to include an option "Any"
which, if selected, will display results from all months ("any" month).
It it were a text field, my "Any" option in the menu would have a value of
"%" - what do I need as the value when working with an INT column?
Thanks.
nath
| |
| Bob Butler 2004-03-30, 7:30 pm |
| "Nathon Jones" <tradmusic.com@btinternet.com> wrote in message
news:c4d035$c8p$1@titan.btinternet.com
> Hi,
>
> I have a menu, with a list of months. I want to include an option
> "Any" which, if selected, will display results from all months ("any"
> month).
>
> It it were a text field, my "Any" option in the menu would have a
> value of "%" - what do I need as the value when working with an INT
> column?
Are you building a SQL query based on the user's selections? If so, jsut
don't use anything in the case they want all (for int or text columns).
--
Reply to the group so all can participate
VB.Net... just say "No"
| |
| Nathon Jones 2004-03-30, 8:31 pm |
| When I do that Bob, I get this error:
Syntax error converting the varchar value 'Any' to a column of data type
int.
This is my form bit:
<select name="startmonth">
<option value="">Any</option>
<option value="1">January</option>
<option value="2">February</option>
etc...
</select>
This is my query;
SELECT *
FROM table
WHERE country = 'MMColParam' AND startmonth = 'startmonthVAR'
What am I doing wrong?
Thanks.
Nath.
"Bob Butler" <tiredofit@nospam.com> wrote in message
news:OcnuDNrFEHA.2472@TK2MSFTNGP10.phx.gbl...
> "Nathon Jones" <tradmusic.com@btinternet.com> wrote in message
> news:c4d035$c8p$1@titan.btinternet.com
>
> Are you building a SQL query based on the user's selections? If so, jsut
> don't use anything in the case they want all (for int or text columns).
>
> --
> Reply to the group so all can participate
> VB.Net... just say "No"
>
| |
| Bob Butler 2004-03-30, 9:30 pm |
| "Nathon Jones" <tradmusic.com@btinternet.com> wrote in message
news:c4d3su$i2p$1@titan.btinternet.com
> When I do that Bob, I get this error:
>
> Syntax error converting the varchar value 'Any' to a column of data
> type int.
>
> This is my form bit:
>
> <select name="startmonth">
> <option value="">Any</option>
> <option value="1">January</option>
> <option value="2">February</option>
> etc...
> </select>
>
> This is my query;
>
> SELECT *
> FROM table
> WHERE country = 'MMColParam' AND startmonth = 'startmonthVAR'
>
> What am I doing wrong?
What I meant was more like this:
<select name="startmonth">
<option value="0">Any</option>
<option value="1">January</option>
<option value="2">February</option>
and in the back end:
sSQL="SELECT * FROM table WHERE country = 'MMColParam'"
If starmonthvar>0 Then sSQL = sSQL & " And StartMonth = " & startmontvar
--
Reply to the group so all can participate
VB.Net... just say "No"
|
|
|
|
|