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


Please Help Members By Posting Answers For Below Questions

What are session objects?

757


Any one can tell how we store tiff format images in database and retrive from the database(need for tiff format only)

1834


Can I tap into other windows livetm services?

767


How many languages are supported by .NET at present time?

559


What is OSI layer? Explain different layers.

813


Is asp.net easy to learn?

748


What is data binding in asp net?

830


What is asp.net with mvc? : Asp.Net MVC

742


Explain the main differences between asp and asp.net?

752


What is http protocol and how it works?

734


What is viewstate? What does the "enableviewstate” property do? Whay would I want it on or off?

725


How do we assign page-specific attributes?

848


Can you explain one critical mapping?

765


What are sql notifications and sql invalidations?

734


What are the advantages and disadvantages of Using Cookies?

728