Thursday, March 29, 2012
Performance problem: DataSet 2 database
i've got a major performance problem.
I've got a dataset with 1 datatable.
This datatable has 3 columns with the following datatypes:
string 18;
datetime
decimal
There are approx 150.000 records in the datatable.
I need to save the values to the database.
Saving the records using a sp is way to slow (12 minutes!)
Does anybody have a faster way?
Ive tried:
http://www.codeproject.com/cs/database/generic_OpenXml.asp?df=100&forumid=171911&select=1344569&msg=1344569
But this didnt work due to the datetime column.
Please help me on this one!!!
TIA
VisualSanderDon't load all 150,000 records at the same time. Is there a reason you need all 150,000 records in there? Can't you do it in batches of, say, 1000?
Monday, March 26, 2012
Performing Arithmetic on DataTable Columns
calculate the Max value that in any of the DataRows, and this DataColumn.
I noticed the DataColumn has an Expression property:
http://msdn.microsoft.com/library/d...essionTopic.asp
However, it seems that I would end up having to create a new DataColumn,
call it MaxVal or something, and populate it for every row.
Is there a cleaner way?Nevermind, I discovered the Compute method.
float flMax =
(float)m_dsSegments.Tables["Calculations"].Compute("Max(Score)",
string.Empty);
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:O30tjLLTEHA.240@.TK2MSFTNGP11.phx.gbl...
> I have a DataTable with only one DataColumn of type float. I need to
> calculate the Max value that in any of the DataRows, and this DataColumn.
> I noticed the DataColumn has an Expression property:
>
http://msdn.microsoft.com/library/d...essionTopic.asp
> However, it seems that I would end up having to create a new DataColumn,
> call it MaxVal or something, and populate it for every row.
> Is there a cleaner way?
>
If your contents are bound to a dataset why don't you just use the dataset
ds.Tables[0].Compute("Max(["+strColumnName+"])",String.Empty)
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:O30tjLLTEHA.240@.TK2MSFTNGP11.phx.gbl...
>I have a DataTable with only one DataColumn of type float. I need to
> calculate the Max value that in any of the DataRows, and this DataColumn.
> I noticed the DataColumn has an Expression property:
> http://msdn.microsoft.com/library/d...opi
c.asp
> However, it seems that I would end up having to create a new DataColumn,
> call it MaxVal or something, and populate it for every row.
> Is there a cleaner way?
>
Performing Arithmetic on DataTable Columns
calculate the Max value that in any of the DataRows, and this DataColumn.
I noticed the DataColumn has an Expression property:
http://msdn.microsoft.com/library/d...essionTopic.asp
However, it seems that I would end up having to create a new DataColumn,
call it MaxVal or something, and populate it for every row.
Is there a cleaner way?Nevermind, I discovered the Compute method.
float flMax =
(float)m_dsSegments.Tables["Calculations"].Compute("Max(Score)",
string.Empty);
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:O30tjLLTEHA.240@.TK2MSFTNGP11.phx.gbl...
> I have a DataTable with only one DataColumn of type float. I need to
> calculate the Max value that in any of the DataRows, and this DataColumn.
> I noticed the DataColumn has an Expression property:
http://msdn.microsoft.com/library/d...essionTopic.asp
> However, it seems that I would end up having to create a new DataColumn,
> call it MaxVal or something, and populate it for every row.
> Is there a cleaner way?
If your contents are bound to a dataset why don't you just use the dataset
ds.Tables[0].Compute("Max(["+strColumnName+"])",String.Empty)
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:O30tjLLTEHA.240@.TK2MSFTNGP11.phx.gbl...
>I have a DataTable with only one DataColumn of type float. I need to
> calculate the Max value that in any of the DataRows, and this DataColumn.
> I noticed the DataColumn has an Expression property:
> http://msdn.microsoft.com/library/d...essionTopic.asp
> However, it seems that I would end up having to create a new DataColumn,
> call it MaxVal or something, and populate it for every row.
> Is there a cleaner way?