If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Need help putting this Query in the right ASP-way

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-09-04, 11:21
Mirador Mirador is offline
Registered User
 
Join Date: Jan 2004
Location: Oslo
Posts: 45
Need help putting this Query in the right ASP-way

Hi and thanx for reading my post..

Well.. my problem is that i cannot seem to get the CASE syntax correct within my ASP page. I'm not sure where to break the lines and all that.

I have searched the net for quiiite a while before posting this

Will be VERY glad if someone can help me to put the puzzle in the right ASP-way

---------------START---------------
strSQL = "SELECT enavn,fnavn,fodselsnr,fangenr,convert(char(10),reg
_date,104) " &_

"'status'= CASE when legal = '1' then "beginner" when legal = '2' then "intermediate" when legal = '3' then "professional" when kan_skal = 'kan' then "darlig foto" else 'status ikke angitt' END " &_

"FROM BILDE WHERE accepted LIKE " & "'1'" & " AND marked LIKE " & "'0'" & " AND pkode LIKE " & strDistrikt & " AND kan_skal LIKE " & "'kan'" & " AND arstall LIKE " & strArstall
---------------END-----------------

What i want to do is getting the three values from the SQL DB which are in the "legal" field (1, 2 or 3), and based on what it is display "beginner", "intermediate", "professional" or "darlig foto".


Best regards
Mirador
Reply With Quote
  #2 (permalink)  
Old 01-09-04, 12:58
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
strSQL = "SELECT enavn,fnavn,fodselsnr,fangenr,convert(char(10),reg
_date,104)," &_

"'status'= CASE when legal = '1' then 'beginner' when legal = '2' then 'intermediate' when legal = '3' then 'professional' when kan_skal = 'kan' then 'darlig foto' else 'status ikke angitt' END " &_

"FROM BILDE WHERE accepted LIKE " & "'1'" & " AND marked LIKE " & "'0'" & " AND pkode LIKE " & strDistrikt & " AND kan_skal LIKE " & "'kan'" & " AND arstall LIKE " & strArstall
Reply With Quote
  #3 (permalink)  
Old 01-09-04, 13:37
Mirador Mirador is offline
Registered User
 
Join Date: Jan 2004
Location: Oslo
Posts: 45
Thanx !!

W00w !! .. that was a quick and gooood reply !

owe u a beer hehe.. tnx a bunch..

Mirador..

Quote:
Originally posted by rnealejr
strSQL = "SELECT enavn,fnavn,fodselsnr,fangenr,convert(char(10),reg
_date,104)," &_

"'status'= CASE when legal = '1' then 'beginner' when legal = '2' then 'intermediate' when legal = '3' then 'professional' when kan_skal = 'kan' then 'darlig foto' else 'status ikke angitt' END " &_

"FROM BILDE WHERE accepted LIKE " & "'1'" & " AND marked LIKE " & "'0'" & " AND pkode LIKE " & strDistrikt & " AND kan_skal LIKE " & "'kan'" & " AND arstall LIKE " & strArstall
Reply With Quote
  #4 (permalink)  
Old 01-09-04, 16:10
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
rnealejr, your query still has singlequotes around status

i know, it's tough spotting every little thing, eh

see http://www.dbforums.com/t977350.html


Mirador, please do a favour to those who might wish to help you, please do not post the same question in more than one forum

and where's my beer?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 01-09-04, 17:19
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Rudy,

The 'status' is just another way to alias a column - just like "select price as 'Total Cost' from ...". However, it is available for backward compatibility, which may create problems with yukon -so beware. I have seen some interesting changes in yukon that might create major headaches for all of us. You can download from ms their best practices analysis tool that will help for migrating.
Reply With Quote
  #6 (permalink)  
Old 01-09-04, 17:31
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
mirador - What country are you programming for - It looks like German or another germanic language ... Ooohhhhh, how I remember (or better yet don't) the beer from Germany/Austria ... sacralicious ...
Reply With Quote
  #7 (permalink)  
Old 01-09-04, 21:18
Mirador Mirador is offline
Registered User
 
Join Date: Jan 2004
Location: Oslo
Posts: 45
Thumbs up Re : Need help putting this .....

German !?!? nononono.... Nor-we-gi-an here... a TRUE Viking hehe..

Sorry for the doublepost... was at work and had about VERY little time to get it fixxed.. will _not_ happen again ¨

Tnx for all the help.. Problem is solved tnx to u guys !
(no mad-boss-on-my-shoulders-weekend)

Happy weekend..
Mirador..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On