|
Hi Munklefish
You're right you need to add a line of code to your fill part.
Change :
munklefish wrote: myAdapter.SelectCommand.CommandText=checksql;
myAdapter.Fill(dataSet11, "tbl_orders");
To:
myAdapter.SelectCommand.CommandText=checksql;
dataSet11.Clear();
myAdapter.Fill(dataSet11, "tbl_orders");
That should do the trick.
munklefish wrote: P.s Jakob,
Jakob Lund Krarup wrote:
10 kinds of people in the world:
- Those who understand binary
- Those who don't
I saw one of your posts ages ago and thought id add the binary joke as my footer in response to yours! I see you've adopted it now.
hehe .. yup - I have it on a T-shirt, and your footer reminded me that it was the perfect companion to my own footer
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Jakob Lund Krarup wrote: dataSet11.Clear();
Jakob,
How come this command has evaded me? Ive looked everywhere for something logical like this but have found no references! Even VS.Net doesnt give me any suitable response.
So much trouble for such a simple solution!!!
Thanks for the help!!!!
munklefish
|
|
|
|
|
Hi Munklefish
I know the feeling. It happens to us all.
There is also a Clear() method on the DataTable class, if you only want to clear a table, and not all tables in a DataSet.
You might consider storing the different tables in one dataset, and then storing the DataSet in Application, to make it easier on the database?
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Jakob Lund Krarup wrote: You might consider storing the different tables in one dataset, and then storing the DataSet in Application, to make it easier on the database?
Jakob,
What does this involve, and how do i do it? I'm totally in this dark on this method.
Thanks!
Munklefish
|
|
|
|
|
Hi Munklefish
Well, now that I've looked your code over again, it seems that you fill the DataTable with very different data for each request, based on the search being done. The method I was referring to is most useful if you have a couple of tables that very seldomly change, then you can load those into Applicationstate (a piece of RAM on the webserver that is shared between all users).
It would work something along the lines of (coding from memory here - might need a bit of IntelliSense later ):
protected void LoadData()
{
if(Application["myData"] == null)
{
dsMyData = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM orders", strConnectionString);
adapter.Fill(sdMyData, "orders");
Application["myData"] = dsMyData;
}
else
dsMyData = (DataSet)Application["myData"];
}
This requires your connectionstring to be in the variable strConnectionString and a DataSet named csMyData to be declared on the Page level. Then you can call the LoadData method from the PageLoad eventhandler, and you will always have the tables in RAM, except for the first time of course. Application is emptied when the last users Session times out (by default 20 minutes after his/her last click on the page).
Since you actually don't need the DataTables in the code you showed me, then the DataReader is actually faster for just getting stuff from the DataBase. (also from memory ... don't hit me if it's not perfect!)
SqlConnection connection = new SqlConnection("server=(local);database=shop;user=me;password=secret");
SqlCommand command = connection.CreateCommand();
command.CommandText = "SELECT * FROM orders WHERE ...yadayadayada...";
connection.Open();
dlOrders.DataSource = command.ExecuteReader();
dlOrders.DataBind();
connection.Close();
Hope this was of some use to you.
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Jakob,
Very Interesting. Ill take a look at that when i have some time.
At the moment im struggling with some other stuff. (see my latest pst)
Thanks again!
Happy Easter!
|
|
|
|
|
munklefish wrote: Happy Easter!
you too
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
Jakob Lund Krarup wrote: hehe .. yup - I have it on a T-shirt.......
GEEK!
|
|
|
|
|
Hehe... - yup! (and proud of it - schhh )
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
|
|
|
|
|
After I covert a 2005 Web Site Project to a 2005 Web Application Project, I got the following Error on a web reference which point to a web service. I removed the reference and add it again but got the same error:
Custom tool error: Unable to import WebService/Schema. Exception of type 'System.Exception' was thrown.
Any help is appreciated.
|
|
|
|
|
Having a huge problem using different IIS servers and one SQL Server State. When the user goes from computer A to B the B computer quicks him out to Login again.
Any solution?
Cheers
Al
My eMail control
My Blog
|
|
|
|
|
|
Thanks, that's what I did. Actually you need to compile a program to generate the machinekey. Just thought that could be added into the Service State to be better solution!
I am writing my own Session State, will see how it comes out
Thanks for all your help!
Al
My eMail control
My Blog
|
|
|
|
|
My project reqiures dispalying windows forms in ASP .NET so that any type of drawing is a possible. Pls could anyone tell me how to do this?
|
|
|
|
|
|
Hello,
I am trying to figure out how to get a textbox in a template field to autopostback. I added a text box to the item template and set the autopostback to true, and it does actually post back. However, I am trying to read information from that text box that caused the post back and I always get a null reference error. How do I make the text box content available in the TextChanged event within the Gridview? Thanks in advance.
Jason
|
|
|
|
|
I have the global.asax file, generated by Visual Studio 2005, with the usual Application_Error method, that's supposed to handle all uncatched exceptions in the web application.
Well, this method is never called, even when I force a NullReferenceException intentionally.
I'm using ASP.NET 2.0.
Does anyone can help me?
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
Hi Dario. What does your Application_Error code look like? Is it possible it is getting called, but not coded in such a way as to make that obvious?
Another possibility is if the exception is generated on a different thread than the main ASP.NET thread. Here's an article that describes it better than I can (Look about halfway down for ASP.NET specifics):
http://www.julmar.com/blog/mark/PermaLink,guid,f733e261-5d39-4ca1-be1a-c422f3cf1f1b.aspx[^]
|
|
|
|
|
Mike Ellison wrote: Hi Dario. What does your Application_Error code look like?
It simply writes in a log (SQL Server) a message including the exception.
Mike Ellison wrote: Another possibility is if the exception is generated on a different thread than the main ASP.NET thread.
I think that is the problem, because after a few tests I noticed that Application_Error has been called some times, but not all the times it should have been called.
Thanks!
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
Looking for a little help. I have a web app that is timing out between 10 and fifteen minutes. The problem is that I have my Session State Timout set to 20 (in Web.Config) and my IIS AspSessionTimeout is set to 20 minutes.
Anyone have any ideas?
Thanks for your time and consideration,
-B
|
|
|
|
|
|
Thanks for the suggestion, but no I'm using:
<authentication mode="Windows">
Thanks again.
|
|
|
|
|
Thanks for the suggestion Mike, but I'm using
authentication mode="Windows"
Thanks again for the suggestion.
|
|
|
|
|
Hi there.
I made an app that displays string, lines and stuff (the code is in Page_Load). I need a way to make sure that part of what is on the asp.net page gets printed on one page and part on another page. I thought that could be achieved by locating what I need way down with a high y value (above 1300) but it didn´t work. Then I tried saving the image on the hard drive and then print out but it didn´t work either, all still get´s printed out on one page (the first).
How can I control what goes on the first page and what on the second page when the contents of my page get printed out on a printer of a user that visits my page?
F
|
|
|
|
|
One strategy would be to use the CSS style attribute page-break-before: always; . Here's an example of what I mean:
<html>
<head>
<title> Page Breaks with CSS </title>
</head>
<body>
<form runat="server">
<p>This text should print on the first page</p>
<p style="page-break-before: always;">
This Text should print on the second page
</p>
</form>
</body>
</html>
|
|
|
|