How do I write a SELECT statement to return one of the selected fields as a mail to link?
Thanks for helping a SQL newbie.
Scott
Do you have some code that is not working correctly?
|||
Thank you for responding.
I'm using Dave O'Leary's Advanced DataGrid to pull content out of a MS SQL 2000 table in a DNN3 application.
Heres the statement:
SELECT TOP 5 Title, Price, EmailContact FROM cs_ClassifiedsItem ORDER BY CreatedDate
The DNN module stores classified ad information. The email address is stored as a character string and is returned as a mailto link at runtime. Advanced DataGrid simply returns the character string. I'd like to add code to the SELECT statement to return the email character string as a mailto link.
Mr. O'Leary provides the following guidance on his websitehttp://www.efficionconsulting.com/Default.aspx?tabid=217: | |
|
|||Then something like this might work for you:
SELECT TOP 5
Title,
Price,
'<a href=''mailto:' + EmailContact + '''>' + EmailContact + '</a>' AS MailToLink
FROM
cs_ClassifiedsItem
ORDER BY
CreatedDate
I don't think that mixing presentation code with data access code is a good idea, however.
|||Thank You! And I appreciate your guidance on mixing code.
Scott
No comments:
Post a Comment