|
| |
|
|
pd_it_guy
Posts: 193 Joined: 3/4/2008 Status: offline
|
SQL troubles - 8/25/2008 19:14:21
The following is a search expression where the number of characters people choose to put in FI_leader matches the same part of the begining of contact name. thus: <% FI_leader=Request.Form("FI_leader") sr_stl=len(FI_leader) fp_sQry="SELECT * from Name_fi WHERE '::FI_leader::' =mid(contact_name,1,sr_stl) AND (status='OK')" The variable part works, as does the query, when I put a real number in. Substituting the variable into my mid is NOT working. The straight variable name sr_stl as shown gets missing expression error, ::sr_stl:: doesnt error but retuns nothing, '::sr_stl::' gets a type mismatch error. Been at this too long today, can anyone help.
|
|
|
|
pd_it_guy
Posts: 193 Joined: 3/4/2008 Status: offline
|
RE: SQL troubles - 8/25/2008 19:21:42
Sorry all for my panic- the one thing I didnt think to try, FI_leader=Request.Form("FI_leader") sr_stl=len(FI_leader) fp_sQry="SELECT * from Name_fi WHERE '::FI_leader::' =mid(contact_name,1," & sr_stl & ") AND (status='OK')" Works perfectly. I guess this is one time you can put double quotes within the SQL's double quotes???
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: SQL troubles - 8/25/2008 19:39:37
The double quote tells the SQL you are about to enter a variable. Then the second double quote tells the SQL to "resume" the SQL string. You will find this won't be the first time you will have to do as you did above.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|