469,575 Members | 1,695 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

Performance issue

We have a legacy application which is in VB. we are migrating it in vb.net (2005).

While coding we found ourself in a fix, the scenario is --

In vb for fetching data we are using Recordset,

While iterating this using while loop we found that iteration is taking 21 sec to fetch about 450 records and looping through them and assigning respective values to excel sheet cells.

For the same thing in vb.net, using Datareader , time is 51 sec. almost 2.5 times. Will you please guide us how can we overcome from this enigma? We have also tried using dataset, but still the response time has not improved.

We have undertaken this migration process mainly for optimizing this process, but instead of performance improvement we are facing performance degradation.

Kindly suggest an alternative. Would really appreciate a quick response.
Feb 20 '08 #1
2 842
1,351 Expert 1GB
Moved to the .NET Forums where the resident experts can better assist you.

**Moved from Programming Challenges
Feb 20 '08 #2
7,872 Expert 4TB
Instead of using a DataReader, consider using a DataAdapter and a DataTable(or DataSet if you want the more encompassing object)
With a DataReader, you have had to have called .Read() and then sift through all data with like .GetValue()

With the DataAdapter you would have something like(with sqlserver as example):
Expand|Select|Wrap|Line Numbers
  1. Dim myDA as SqlDataAdapter
  2. Dim myDT as DataTable
  3. '
  4. ' you would set up your SqlCommand as normal and assign it to myDa
  5. ' it's a quick step, check msdn
  6. '
  7. myDT= new DataTable()
  8. myDA.Fill(myDT)
Now you have a full datatable object with everything from your query.
Column names can be accessed via string or index.

Investigate that and see if it helps. I am not sure if that is your problem, but I routinely do over a thousand records from a query, then do a bunch of post-process stuff on each entry and it all takes less then a second.
Feb 20 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by **ham | last post: by
115 posts views Thread by Mark Shelor | last post: by
13 posts views Thread by bjarne | last post: by
7 posts views Thread by James | last post: by
17 posts views Thread by 57R4N63R | last post: by
5 posts views Thread by Varangian | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.