1.can we add connection string in global.asax??????????
2.what are the default files included when we create new
web application????
Answer Posted / deepak
<%@ Import Namespace=”System.Data” %>
<%@ Import Namespace=”System.Data.Odbc” %> <script
language=”C#” runat=”server”>
void Application_Start()
{
//Connection string for SQL Server with trusted
connection
Application.Add (”DB_CONNECTION_STRING”,”DRIVER={SQL
Server};SERVER=ServerName;DATABASE=DataBaseName;Trusted_connection=yes;”);
}
void Session_Start()
{
//open connection to database
OdbcConnection cnConnection = new OdbcConnection
(Application.Get(”DB_CONNECTION_STRING”).ToString());
cnConnection.Open();
Session.Add (”DB_CONNECTION”, cnConnection );
}
void Session_End()
{
//a graceful disconnect
OdbcConnection cnConnection = (OdbcConnection)
Session["DB_CONNECTION"];
cnConnection.Close ();
}
</script>
Is This Answer Correct ? | 11 Yes | 2 No |
Post New Answer View All Answers
What are session objects?
Any one can tell how we store tiff format images in database and retrive from the database(need for tiff format only)
Can I tap into other windows livetm services?
How many languages are supported by .NET at present time?
What is OSI layer? Explain different layers.
Is asp.net easy to learn?
What is data binding in asp net?
What is asp.net with mvc? : Asp.Net MVC
Explain the main differences between asp and asp.net?
What is http protocol and how it works?
What is viewstate? What does the "enableviewstate” property do? Whay would I want it on or off?
How do we assign page-specific attributes?
Can you explain one critical mapping?
What are sql notifications and sql invalidations?
What are the advantages and disadvantages of Using Cookies?