Results 1 to 8 of 8

Thread: from datareader to array

  1. #1

    Thread Starter
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530

    from datareader to array

    Anyone know the most efficient way from one t'other?

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    A datareader only reads the line that it is currently one when it comes to it so you'd just have to loop and read into the array. I am assuming you mean array of datarows.

  3. #3

    Thread Starter
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Yep... I wanna get all the data into an array and send it back....

    But in vb6 there was a getrows method which was way faster than looping through records one by one... so I was trying to find the equivalent in .net, any ideas?

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    If you are going to be sending it back you should use a dataset. Or you can still use the ADODB recordsets from vb6.

  5. #5
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    I haven't worked with DataReader, but you may want to also look into putting the data into a DataSet table and then .Selecting from that, which returns rows in an array, e.g.

    Dim arrRows() As DataRow = dsData.Table("Table").Select("Field = 'Foo'")

    returns an array of rows where Field = Foo.

    ...

    Doh!! Beat me again! heh.

  6. #6

    Thread Starter
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530
    Problem is that is slower and a less scalable solution. I like managing concurrency myself and using stored procs to do the updates / deletions... Just wondering if there was a getrows equivalent in .net?

    Also because I work with sybase I am using odbc ado objects and they don't work well with web services, so I am forced to pass back arrays rather than ADO datasets/datareaders.

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    In that cause no I don't think there is anything like getrows in .NET, but hopefully someone will prove me wrong.

  8. #8
    Hyperactive Member hassa046's Avatar
    Join Date
    May 2001
    Location
    Venlo, The Netherlands
    Posts
    336

    Re: from datareader to array

    Quote Originally Posted by Edneeis
    In that cause no I don't think there is anything like getrows in .NET, but hopefully someone will prove me wrong.
    Actually there is a way... look at http://www.developerfusion.co.uk/show/4566/
    Better to regret things you did, than those you didn't
    International Intelligence

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width