Performance issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ermayank
    New Member
    • Feb 2008
    • 1

    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.
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    Moved to the .NET Forums where the resident experts can better assist you.

    **Moved from Programming Challenges

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      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):
      [code=vbnet]
      Dim myDA as SqlDataAdapter
      Dim myDT as DataTable
      '
      ' you would set up your SqlCommand as normal and assign it to myDa
      ' it's a quick step, check msdn
      '
      myDT= new DataTable()
      myDA.Fill(myDT)
      [/code]
      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.

      Comment

      Working...