Drop Down sql select value (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


chadb -> Drop Down sql select value (5/7/2008 11:48:38)

I have a dropdown list that I am trying to select that value from. Here is the drop down box:
<select size="1" name="WorkCenter">
<option selected value="%">All</option>
<option value="Assy">Assembly</option>
<option value="3SCREW">Screw</option>
</select>

here is the select statement.

fp_sQry="SELECT * FROM Item WHERE (wc like '::workcenter::')"

It will not return any records, if I change it to one of the values of the drop down, it works:
fp_sQry="SELECT * FROM Item WHERE (wc = 'assy')"




rdouglass -> RE: Drop Down sql select value (5/7/2008 12:42:27)

quote:

WHERE (wc like '::workcenter::')"


Like requires the "%" wildcard character.

(wc like '%::WorkCenter::%') : "contains"
(wc like '::WorkCenter::%') : "begins with"
(wc like '%::WorkCenter::') : "ends with"

That help any?




chadb -> RE: Drop Down sql select value (5/7/2008 12:46:00)

could I use fp_sQry="SELECT * FROM Item WHERE (wc = '::assy::')" if it is the exact value I have in <option value="Assy">Assembly</option> ?? Because this does not work.




rdouglass -> RE: Drop Down sql select value (5/7/2008 12:50:00)

quote:

fp_sQry="SELECT * FROM Item WHERE (wc = '::assy::')"


Nope, because "assy" is not the name of the form field.

See the :: double colon sign in the FrontPage DRW is kinda' shorthand for "Request.Form" so what you're saying is Request.Form("assy") which there is none.

You can do:

"SELECT * FROM Item WHERE (wc = 'assy')"

but that's hard-coding the value and I don't think that's what you want to do is it?

Also, double check your capitalization for your fields and such; it can make a diff.

Hope it helps.




chadb -> RE: Drop Down sql select value (5/7/2008 12:54:32)

OK, so (wc = '::assy::')" the assy needs to be the name of the drop down box, in my case WorkCenter, so (wc = '::WorkCenter::')" then the sql string would be, if the value if the dropdown box is "Assy" is would be (wc = 'Assy')" right??

Thanks




DesiMcK -> RE: Drop Down sql select value (5/7/2008 14:51:29)

Hi chadb,

quote:

so (wc = '::assy::')" the assy needs to be the name of the drop down box, in my case WorkCenter, so (wc = '::WorkCenter::')" then the sql string would be, if the value if the dropdown box is "Assy" is would be (wc = 'Assy')" right??


You are right. Hope it works,

Desi




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625