× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Somewhere you are mapping the DataTable to List<T> already for every model. This just does it up front. You may be doing the mapping inefficiently, no code was provided on that front to see how you were mapping DataTable to List<T>.

Post to .net midrange forum...

Matt

-----Original Message-----
From: Mike Wills [mailto:mike@xxxxxxxxxxxx]
Sent: Tuesday, March 12, 2013 12:23 PM
To: Midrange Systems Technical Discussion
Subject: Re: SQL Result Paging

But how do I translate that in to a generic method that can be used for any model? That is the purpose of GetData().

--
Mike Wills
http://mikewills.me


On Mon, Mar 11, 2013 at 4:53 PM, Matt Olson <Matt.Olson@xxxxxxxx> wrote:

In regards to #1, you can optimize it to be as follows, get rid of the
data table and then translate to List<T> (if you are using reflection
to do this you are going to get a performance hit). I imagine you
thought it would be good to get everything back as a DataTable and
then create some sort of extension method that uses reflection to bind
data table columns to class properties. This is going to be a bit slow.

Instead do something like the following:

public List<ClassName> GetData(string sqlStatement,
Action<iDB2ParameterCollection> parameters) {
List<ClassName> data = new List<ClassName>();

Using(iDB2Command cmd = new iDB2Command(sqlStatement,conn))
{
//todo: add parameters to cmd object

iDB2DataReader dbRdr = cmd.ExecuteReader();
while (dbRdr.Read())
{
ClassName tempData = new ClassName();
tempData.property1 = dbRdr["field1"];
tempData.property2 = dbRdr["field2"];
data.Add(tempData);
}
dbRdr.Close();
}
return data;
}

-----Original Message-----
From: Mike Wills [mailto:mike@xxxxxxxxxxxx]
Sent: Monday, March 11, 2013 4:34 PM
To: Midrange Systems Technical Discussion
Subject: Re: SQL Result Paging

Actually I tracked it down.
1) how I was pulling the data took 30 seconds to generate a datatable
and build a List<T> object. I'll have another question posted tomorrow
about improving that.
2) It took MUCH longer for the Web API to work it's magic and generate
what it generates. So it has nothing to do at all with the data and is
instead a WebAPI issue that I need to work around. (Which is off-topic
on this list).

--
Mike Wills
http://mikewills.me


On Mon, Mar 11, 2013 at 3:14 PM, Matt Olson <Matt.Olson@xxxxxxxx> wrote:

Nothing too peculiar there.

Are you 100% sure that this line:

using (iDB2DataAdapter da = new iDB2DataAdapter(cmd)) { da.Fill(dt);
}

Is causing the 3 minute delay? Did you test it through the debugger?

Reason I ask is this line: "The speed issue in here as calling the
directly from Poster in Firefox takes 3 minutes.".

This would seem to indicate to me that perhaps it is taking Firefox
3 minutes to parse the massive amount of data you are sending back,
over a 56K modem line :-)

-----Original Message-----
From: Mike Wills [mailto:mike@xxxxxxxxxxxx]
Sent: Monday, March 11, 2013 3:05 PM
To: Midrange Systems Technical Discussion
Subject: Re: SQL Result Paging

The relavant code is posted at
https://gist.github.com/MikeWills/528dac8511b9295cdb16

--
Mike Wills
http://mikewills.me


On Mon, Mar 11, 2013 at 2:57 PM, Matt Olson <Matt.Olson@xxxxxxxx> wrote:

I'm thinking something else is going on with your application or
you are running the query through a 10MB half-duplex Ethernet line
:-)

We return thousands of rows in 1-2 seconds time, 800 rows should
be under a second in our environment using C# ASP .NET app.

Paste the code to the midrange .NET mailing list -
systemidotnet@xxxxxxxxxxxx.

-----Original Message-----
From: Mike Wills [mailto:mike@xxxxxxxxxxxx]
Sent: Monday, March 11, 2013 2:29 PM
To: midrange-l@xxxxxxxxxxxx
Subject: SQL Result Paging

I have a query that is sub-second. When I run it on the
green-screen, I get a result as soon as I hit "enter". So I know
that that query itself isn't the problem. I am returning around
800
results.

However, when I pipe it through my C# ASP.NET application, it
takes FOREVER (okay 3 minutes), but lets be honest, that is
forever in the web world.

My question is, how do I go about adding paging to my query. I
found this
400 Guru article
(http://www.itjungle.com/fhg/fhg111109-story01.html),
but was wondering if there were other ways. Maybe using a stored
procedure or something?

--
Mike Wills
http://mikewills.me
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at http://archive.midrange.com/midrange-l.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.