Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 asp variables stored in sql server

Author  Topic 

Pumpkins_Man
Starting Member

20 Posts

Posted - 2002-06-03 : 23:08:30
I'm currently creating a dhtml drop down menu that is created from data gathered from SQL server using asp. i have a name and a URL stored in data fields in sql server. the problem i'm having is that some urls need to have a parameter on the end.

eg. http://dc2/intranet/news/newslist.asp?Unit_ID=<%=Request.Cookies("Dept_ID")%>

however the data doesn't get parsed by either sql server or asp...i'm not sure which. i'm guessing it might have something to do with the "'s in sql server.

is there any way of storing the link in sql server so that it will achieve the required result?

thanks in advance,

bronson

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-06-03 : 23:16:17
No. You can't incorporate ASP code into SQL data, because the ASP process will not interpret it as code. Well, you can, you can try the Eval() function, but don't be surprised if your ASP page goes kablooey.

What you can do however is take the value of the cookie and pass it along to SQL Server, and it can construct the proper URL when it returns the value back to the ASP page:

ID=request.cookies("Dept_ID")
rsObj.Open "EXEC GetOptionList @id=" & ID, connObj
...etc.


CREATE PROCEDURE GetOptionList @id int AS
SELECT 'http://dc2/intranet/news/newslist.asp?Unit_ID=' + CAST (@id as varchar)
FROM myTable


Something like that should get you started.

Edited by - robvolk on 06/03/2002 23:16:57
Go to Top of Page
   

- Advertisement -