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
 Transact-SQL (2000)
 Stored procedures and Session Timeout

Author  Topic 

Swede
Yak Posting Veteran

74 Posts

Posted - 2002-01-21 : 07:22:39
Hi again folks,

Ive been using the stored procedures now but found that on pages where I check if the session has timed out and then redirects you unto another page, the stored procedure doesn't care about the redirect page and somehow overrides my session check, even though it is located at the top of the page.

My stored procedure is using the session to filter which data to show, but that shouldn't matter, should it?

If I convert the query and type my SELECT statemant as in the old ways, the redirect works...

Any ideas or solutions to this? I am a bit clueless to this...

=====================================
Why not try and do the impossible?

Swede
Yak Posting Veteran

74 Posts

Posted - 2002-01-21 : 08:19:09
Found this to work:

user_id = Session("user_id")
If user_id = "" Then user_id = 0
SQL = "count_new_messages " & user_id

But, is there another way? Does SP's always need the data, even if the it is not supposed to run? If I manually enters the user_id here... the Redirect I have in the top of the page actually works... If I dont, then it don't work...

=====================================
Why not try and do the impossible?
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-01-21 : 09:36:42
you can set a default value on the parameters of your sp.




--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page

Swede
Yak Posting Veteran

74 Posts

Posted - 2002-01-21 : 09:40:08
Alright, so if there is no value sent to the SP it will use the default one? How do I do that then?

=====================================
Why not try and do the impossible?
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-01-21 : 09:46:33
you are right

create procedure aa(@d int = 10)
AS SELECT @D

exec aa will return 10. if you pass a value it will take that.

HTH

--------------------------------------------------------------
Dont Tell God how big your Problem is , Tell the Problem how Big your God is
Go to Top of Page
   

- Advertisement -