global.asax

S

simonZ

In asp.net 1.1 I had the following statements in global.asax file:

Using System.Data.SqlClient;
Using System.Web.SessionState;

In asp.net 2.0 I can't access them any more.

For example:

void Application_Start(Object sender, EventArgs e) {
String sql;
SqlCommand oCmd;

sql = "SELECT set_value FROM cpoSettings where set_id=2";
oCmd = new SqlCommand(sql, funkcije.createConnection());
oCmd.CommandType = CommandType.Text;
Application["val"] = oCmd.ExecuteScalar();
oCmd.Connection.Close();

if (Application["val"] = =1){
SqlDataReader rdr;
... and so on
}
}

How can I access to those objects in asp.net 2.0?

Regards,S
 
W

w.chishti

In ASP.NET 2.0 global.asax is by default in InLineCode mode.
to reference namespaces (using statement ) you have to use following
format
<%@ Import Namespace = "System.Data" %>

or you Provide fully qualified name of Class e.g.


void Application_Start(Object sender, EventArgs e) {
String sql;
System.Data.SqlClient.SqlCommand oCmd;
..........................................
 
W

w.chishti

In ASP.NET 2.0 global.asax is by default in InLineCode mode.
to reference namespaces (using statement ) you have to use following
format
<%@ Import Namespace = "System.Data" %>

or you Provide fully qualified name of Class e.g.


void Application_Start(Object sender, EventArgs e) {
String sql;
System.Data.SqlClient.SqlCommand oCmd;
..........................................
 
W

w.chishti

In ASP.NET 2.0 global.asax is by default in InLineCode mode.
to reference namespaces (using statement ) you have to use following
format
<%@ Import Namespace = "System.Data" %>

or you Provide fully qualified name of Class e.g.


void Application_Start(Object sender, EventArgs e) {
String sql;
System.Data.SqlClient.SqlCommand oCmd;
..........................................
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top