SqlDataSource, GridView

Z

zp

Hi there,
Have a web page with SqlDataSource and GridView (.NET 2) that gets and
displays data from database. The connection to the database is opened on page
load and the grid is populated. I have no problem at all on my testing
machine, IIS5 or VS development server, but when I deploy it on a remote
server (win2003, IIS6) and the page is displayed the data not showing in the
grid all the time. Some times I have to click several times back and forth in
order the grid to be populated with data. This is the code I use on page load
event:

protected void Page_Load(object sender, EventArgs e)
{
try
{
string LClassTutor;
LClassTutor = (String)Session["UserId"];
Parameter Parameter1 = new Parameter();
Parameter1.Name = "@CR";
Parameter1.Type = TypeCode.String;
Parameter1.DefaultValue = LClassTutor;
DsStdOnClass.SelectParameters.Add(Parameter1);
GvStudents.DataBind();

}
catch
{
Session["ERROR"] = "Parameters definition";
Server.Transfer("Error.aspx", true);
}
}

Have tried many variation of the above code but the problem persists. Any
suggestion where to look for possible solution?

Thanks
zp
 
Z

zp

Answering my own question. The problem was in the lost session value. I've
used a session to store the user login info, which was used as a parameter
(@CR) in the query. The IIS6 kills the session for some reasons, and the
value is reset, so my user id was lost, and the query failed. I've decided to
use Cookies to store the value of the user id and all is working fine now.
 

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,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top