i’m building my web application to connect with db.
so far i have managed to deal with it, (although i didn’t build BLL & DAL).
i have a table which has column “id”. i know there is a way to declare it in the SQL Server to be incremented automatically. ( but i don’t want it).
i want to declare a global application variable that will hold the value.
i have 2 questions:
-
how i declare it?
-
where i create it and initialize it ? (i have several login pages).
THANKS!
p.s
it would be helpful if someone will tell me how do i build the DAL with my stored procedures?
and for what i need yo use BLL which i cant do in the DAL?
You can use the
Applicationobject – it is part of theHttpContextand is directly accessible on any page.If you don’t want to use it, you may want to write a
Globalsclass (or whatever name you like) that holds static members.Either approach will not work of you have a web farm or several web applications and will not survive restarts.
Regardless of these options, the right solution (even if you don’t want to use it – can you explain why?), is to use the ID field with the
IDENTITYclause.