|
Dave Kreskowiak wrote: Hint: Retrieve less rows! If you're not doing anything with ALL of those rows, there's no reason to retrieve them, now is there?
Exactly. I don't understand why people want to fetch that much at once, unless it is some kind of coordinate mapping/computing thingee-bobber.
Dave Kreskowiak wrote: 100,000 rows and 8 to 9 seconds
That's on the order of approximately 10k records/second...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
MyDataTable get data(rows) from Xml file not from database.
If I use MyDataTable.DefaultView.RowFilter = "xxx",
it will spent time for this process instead.
8 to 9 seconds is not fast enough for me.
Is there any idea to improve performance?
|
|
|
|
|
Break up the xml file to smaller files and load the correct one base off whatever RowFilter you are planning on setting.
Ben
|
|
|
|
|
An XML file is a just a Text file. It takes a LONG time for the DataSet class to load AND PARSE that much stuff. 8 to 9 seconds for a file that big is GOOD. You simply have no choice but to break that file down into smaller chunks, organized how you want it filtered, then load only those files that you need.
There is no other way to speed this up...
|
|
|
|
|
Dave Kreskowiak wrote: 8 to 9 seconds for a file that big is GOOD.
No kidding, especially for an XML file. Talk about bitching over spilled milk... If it is such a big deal, then he needs to refactor the problem into a smaller file like kubben recommended.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
8-9 seconds that I tell you not include Load AND PARSE Xml file.
DateTime d1 = DateTime.Now;
DataGridView1.DataSource = MyDataTable
DateTime d2 = DateTime.Now;
TimeSpan ts = d2 - d1;
Console.WriteLine(ts);
Thank You.
|
|
|
|
|
god4k wrote: 8-9 seconds that I tell you not include Load AND PARSE Xml file.
Then why did you say so?!?
god4k wrote: DateTime d1 = DateTime.Now;
DataGridView1.DataSource = MyDataTable
DateTime d2 = DateTime.Now;
TimeSpan ts = d2 - d1;
Console.WriteLine(ts);
You're not seriously rendering 100,000 rows in a dataGrid, are you?? Is the user even going to look at all of that crap?? You really need to rethink your design, 'cause there is no way to speed up the rendering of 100,000. What does the user need to see?? That is all you should be showing them. I can't think of a single good reason to show a user 100,000 rows of a table...
|
|
|
|
|
Cut the amount of data down as Dave has said. Only pull up the data that the user is going to be using at the moment, and 100,000 rows is not going to be the case. Allow the user to filter the rows he/she is going to need.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Why is it that no machine is fast enough for some "developers"???
|
|
|
|
|
No kidding. I've got a P4 running at 2.5ghz and 1gig ram. It fits the bill for my development projects. I even have test station boxes running between 233mhz and 1.8ghz :->
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
The DataGridView can be a pretty slow control to render large amounts of data, and as noted by others, it looks as if you're getting pretty good performnace. However, performance, and the illusion of performance are not quite the same thing.
If your application looks as if it has hung during this 8-9 second load, then users might suspect it as having crashed. In which case, you might like to have this loading happening in a different thread, at least that way you can update the UI with a natty progress bar or similar. Taking this approach, however, may actually slow down the load - but the user will probably think it works more quickly than if the screen just locks up.
"It was the day before today.... I remember it like it was yesterday."
-Moleman
|
|
|
|
|
Have you given a thought of using the Virtual mode in the Datagrid?
GJ
|
|
|
|
|
Nice idea, but it's not a solution to the root cause of the problem - poor design.
|
|
|
|
|
Hi
I have a crystal report invoicing application that generates invoices. i have a logo on that invoice. I wanted to change the image based on if some condition met on code behind.
Can anyone please shed some light on how to do this.
This is what i am doing currently.
private void CreateImageDataTableAndWriteSchema()
{
this.DsImages = new DataSet();
DataTable ImageTable = new DataTable("Images");
ImageTable.Columns.Add(new DataColumn("path", typeof(string)));
ImageTable.Columns.Add(new DataColumn("image", typeof(System.Byte[])));
this.DsImages.Tables.Add(ImageTable);
//this.DsImages.WriteXmlSchema(@"c:\myinvoices\ImagesSchema.xsd");
}
as you can see from commented code that, I am creating an xsd dataset and I have added that dataset to the database fields. Then i have place image field from that table on to the report document. Then below i am loading an image file in that dataset/datatable.
then i am loading image in to the dataset created above
private void LoadLogoImage()
{
FileStream FilStr = new FileStream("C:\\mystuff\\Images\\my_logo.jpg", FileMode.Open);
BinaryReader BinRed = new BinaryReader(FilStr);
DataRow dr = this.DsImages.Tables["Images"].NewRow();
dr["path"] = "C:\\mystuff\\Images\\my_logo.jpg";
dr["image"] = BinRed.ReadBytes((int)BinRed.BaseStream.Length);
this.DsImages.Tables["Images"].Rows.Add(dr);
FilStr.Close();
BinRed.Close();
}
Lastly, i am setting the datasource of the report document as following
reportDocument.Subreports[SummaryDocument].Database.Tables["Images"].SetDataSource(DsImages.Tables["Images"]);
I get error, invalid index when i try to execute this line.
As stated above, i am trying to set the Images table datasource to the dataset we just poppulated with image path and byte data.
fyi: i have a master report which holds 8 subreport. The SummaryDocument listed above is one of those subreport.
Thanks
Needy
|
|
|
|
|
Hie again!
My friend has sent me a controlcode for viewing a GISMAP,but unfortunately I don't know how to use it.I mean how can I add a map in a C# project to view that map?
|
|
|
|
|
Please read the forum guidelines and going forward give your messages a title with meaning.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
maybe your friend knows ?
|
|
|
|
|
Considering we know NOTHING of the control (is it really?) he sent you, you're ONLY two sources of information on how to use it are (1) your friend, and (2) the manufacturer of the control.
|
|
|
|
|
Like the other posters have replied, try your friend and the control manufacturer. Your post is not very detailed...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hello,
I thought this would be easy to do but the answers I have found tend to involve writing a strongly typed data table or adding a linked table in SQL Server.
My SQL Server table has a value listed of 1 and 0 in the column for Status. I have added a DataGridView control to my form and I want to change the 1 to "Administrator" and the 0 to "User". Is there a simple way of doing this without adding a data table to my SQL Server or typing a strongly typed Data table class?
Thanks,
Boyd
Boyd
|
|
|
|
|
Yes, you can use a calculated column. For example:
DataTable table;
table = ....
table.Columns.Add("TextStatus", typeof(string), "IIF(Status = 1, 'Administrator', 'User')"); For more things you can do with calculated columns, check DataTable.Expression[^]
I hope this helps!
|
|
|
|
|
Can you try this in your SQL statement when retrive the data:
SELECT
....
StatusValue = CASE WHEN Status = 1 THEN 'Administrator' ELSE 'User' END
FROM
...
Not sure this answer your question?
Eliz.K
|
|
|
|
|
Hi All,
This is Windows Forms, not web.
I've got a class, who's properties are normally exposed to my users in a PropertyGrid control.
Some of the properties have attributes from the System.ComponentModel namespace to hide, force read only, or rename attributes (DisplayName, ReadOnly, Browsable etc).
Now, for some users (those with a superuser access), I need to expose some of the hidden properties, in a DataGridView.
But the attributes are causing problems... When I bind a DataGridView to a List<t> of my objects, only the columns shown in the PropertyGrid are shown.
Even if I disable automatic column generation, and try to manually create columns, like this:-
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = my List<T>;
DataGridViewColumn column = new DataGridViewTextBoxColumn();
column.Name = "Column Name";
column.DataPropertyName = "HiddenProperty";
dataGridView1.Columns.Add(column);
The created column simply comes out blank.
Does anyone know a way round this? Other than (of course) losing the databinding functionality and filling the DataGridView manually?
Thanks
Jon
|
|
|
|
|
|
Guys,
How can I access a shared secured folder from code (VB/C#) that will not show the UserName/Password dialogue box?
Thank you
ThaScorpion
ThaScorpion
|
|
|
|