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 is the best Macanism to clear the Cache in asp.net
What is the difference between the asp and asp.net?
Who generates session id?
Is sql backend or frontend?
What is a postback ispostback and autopostback in asp net?
Explain the asp.net mvc request life cycle? : asp.net mvc
What is the difference between a multi-layer and multi-tier applications?
Define authentication and authorization.
How ASP and ASP.NET page works? Explain about asp.net page life cycle?
Why is this service branded with windows livetm?
Difference between using directive vs using statement?
What is the difference between session and viewstate?
9. Why should we hire you over the others waiting to be interviewed?
Explain what benefit does your code receive if you decorate it with attributes demanding specific security permissions?
What is content place holder?