Results 1 to 3 of 3

Thread: Check returned records

  1. #1

    Thread Starter
    Addicted Member soluga's Avatar
    Join Date
    Dec 2005
    Location
    Manchester (Uk)
    Posts
    211

    Resolved Check returned records

    I have a function that adds to my collection, but I dont want to add it to my collection if more than one result is returned, how can I check how many records are being returned in the dataset ??
    VB Code:
    1. If e.Column.Key = "productRangeCode" Then
    2.                 If _rangeCode.Length > 0 Then
    3.                     Dim _component As New Component
    4.                     _component.Load(_rangeCode) ' This calls my load function in my class
    5. 'I need to check here how many are returned before adding to my collection ??????
    6.                         product.Formulation.Add(_component)
    7.                         GridExFormula.Refetch()
    8.                                     End If

    Thanks
    Last edited by soluga; May 22nd, 2006 at 06:54 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Check returned records

    I have no idea what any of that code is doing so because you haven't given any indication of what any of the objects or methods are. A bit of context might be nice. My guess would be that instead of testing that Length is greater than zero you should test that it's equal to one.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member soluga's Avatar
    Join Date
    Dec 2005
    Location
    Manchester (Uk)
    Posts
    211

    Re: Check returned records

    sorry, was bit vague wasnt it.
    anyway I figuered it out...
    VB Code:
    1. _recordsCount = _component.Load(_rangeCode, _colourCode, _versionNumber).Tables(0).Rows.Count

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