Results 1 to 2 of 2

Thread: [2.0] dataset current record

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2006
    Posts
    719

    [2.0] dataset current record

    how to get the dataset current row? this code doesnt work?

    Code:
    DataRow CurrentRow = dDataSet.Tables["tblPatient"].Position

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

    Re: [2.0] dataset current record

    There's no such thing as a current record in a DataSet because DataSets don't have records. DataSets have DataTables. DataTables have records, but they still don't have current records. You can bind the same DataTable to multiple controls and each one could be displaying a different record. If it's not bound to any controls then the concept of a current record has no meaning whatsoever.

    If you want to bind a DataTable to a control you should do so via a BindingSource. The BindingSource has two properties of interest that indicate the record currently selected in the bound control: Current (the record) and Position (the index of the record).
    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

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