|
TO use SqlConnection instance or static variable. -- "just.starting --
I have 15-20 pages in my website and each page need to connect to the sql server using SqlConnection. So what I have done is made a class putting all my query types as static functions (like doing a query, getting int/string/guid in return for a query) to access from all my pages. Then I pass the query and SqlConnection instance for that page to the static function. Here I am instantiating the SqlConnection instance in all pages at pageload. Can I make a static SqlConnection variable and use that in the static functions instead. But then all the httprequests will use the same sqlconnection static variable. Won't it cause any problem. I think I have made myself clear. If anyone has any doubt please reply back. |