473,395 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Global.asax

Hello everybody:

I'm getting trouble with global.asax. Inside it, i define a sqlconnection, a
dataadapter and a dataset.

In the Session_Start i declare the session variables calls conn, da and ds.

Later, i make a webform and when i instante the session variable da, its
point to null and the ds too.

How can i make this right...

Greetings...

Leo
Nov 15 '05 #1
3 3752
can you post the code where you use the DataSet in your webform

--

---
Email: kunal.das[at]removethis-.sclot.com
---
"Ing. Leandro Pérez Guió" <lp****@holguin.copextel.com.cu> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Hello everybody:

I'm getting trouble with global.asax. Inside it, i define a sqlconnection, a dataadapter and a dataset.

In the Session_Start i declare the session variables calls conn, da and ds.
Later, i make a webform and when i instante the session variable da, its
point to null and the ds too.

How can i make this right...

Greetings...

Leo

Nov 15 '05 #2
"Ing. Leandro Pérez Guió" <lp****@holguin.copextel.com.cu> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Hello everybody:

I'm getting trouble with global.asax. Inside it, i define a sqlconnection, a dataadapter and a dataset.

In the Session_Start i declare the session variables calls conn, da and ds.
Later, i make a webform and when i instante the session variable da, its
point to null and the ds too.


Not sure what your aim is, but Session objects usually have to be unboxed
when you go to use them again. Your best bet would be to fully instantiate a
new object locally, and only then assign it to the session variable.

private void DoDataStuff(string ConnectionString)
{
SqlDataAdapter da = new SqlDataAdapter("select * from db",
ConnectionString);
Session["da"] = da;
//etc.
}

R.
Nov 15 '05 #3
Hi leandro,

I think that it's not a good idea to keep a SqlConnection on session ,
worse if you keep it open.

I instead would keep the ConnectionString and open/Close the connection on
the page as needed.

This is how you work with session variables

Session_Start ( ... )
{
//Create teh dataset
DataSet dataset = CreateDataSet();
//put it in session
Session["dataset"] = dataset;

//Get it value
DataSet copy_dataset = ( DataSet) Session["dataset"];

}
I don';t know if this make it clear for you, if not just post back the code
where you set the session variables and where you are using them.

Un Saludo desde Miami :)
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Ing. Leandro Pérez Guió" <lp****@holguin.copextel.com.cu> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...
Hello everybody:

I'm getting trouble with global.asax. Inside it, i define a sqlconnection, a dataadapter and a dataset.

In the Session_Start i declare the session variables calls conn, da and ds.
Later, i make a webform and when i instante the session variable da, its
point to null and the ds too.

How can i make this right...

Greetings...

Leo

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: fd123456 | last post by:
Hi Tom ! Sorry about the messy quoting, Google is playing tricks on me at the moment. > Global.asax is where you normally have the Global Application > and Session variables and code to...
12
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it...
8
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
2
by: Steve | last post by:
I am new to this newsgroup & to .NET in general. I have been playing around with Visual Studio .NET, building and rendering web pages using VB "code behind" files. My problem / question is; How...
11
by: Ron | last post by:
I have a web project compiled with the new "Web Deployment Projects" plugin for VS2005. I'm deploying the web project to one assembly and with updateable option set to ON. When I'm running the...
4
by: Al Santino | last post by:
Hello, I've created a simple C# web services project using Visual Studio 2005. My service compiles and runs correctly when called by remote clients. I'm able to step through the service in the...
16
by: thefritz_j | last post by:
We just converted our VS2003 1.1 VB web project (which was working fine) to VS2005 2.0 and now I get: Parser Error Message: Could not load type '<Namespace>.'. Source Error: Line 1: <%@...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
15
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.