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
In a webservice, need to display 10 rows from a table. Which is the best choice among datareader or dataset?
what are the Custom controls in asp.net?
What is difference between or and orelse?
Describe the .net base class library.
What are the different types of cookies in asp.net?
What is asp.net web pages?
How do we assign page-specific attributes?
Dataset is the disconnected environment. suppose if you are binding records to gridview (disconnected environment) and you are making changes to the the grid but before updating the database if any other user modify the data, how will you avoid such problem?
What are the differences between the response.write() and response.output.write()?
How can I open ashx file in mobile?
What is enableviewstate in asp net?
Is react a template engine?
Is asp.net different from asp? If yes, explain how?
How can i explain my project during interview?many time i expalain my project but they did't accept? please explain me.
What is the best Macanism to clear the Cache in asp.net