Results 1 to 2 of 2

Thread: [2005] Retrieving info from DataSet

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    28

    Question [2005] Retrieving info from DataSet

    I'm a real newbie to 2005. I just completed my into to vb.net. I have a problem compairing a txtBox to a field in a MS Access table.

    I have used the wizzard to connect to a SemProj.mdb and to the table tblInstructor. tblInstructor has three Columns. ID, InstrName, UserID.

    I have created cboUsrName and combined ID with InstrName, but returns only the ID in txtUserIDtoCheck

    Created a txtBox, txtUsrIDtoCheck

    I created txtUsrID & txtUsrPswd.

    Now I want to compair the info given by the user is txtUserID & txtPswd against the data in my Access table.

    I know how to use the tableadapter to fill the database and how to use a datagridview on a form.

    How do you get the info back from the dataset??

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

    Re: [2005] Retrieving info from DataSet

    Your DataSet has a property for each DataTable it contains. You use a TableAdapter to populate the corresponding DataTable. That DataTable now contains DataRows, which you can access by index. Those DataRows have a property for each column in the table. So, let's say that you want to get the value of the InstrName field from the second row of the tblInstructor table:
    VB Code:
    1. Dim instrName As String = myDataSet.tblInstructor(1).InstrName
    Note that all arrays and collections are zero-based, so index 1 is the second item.
    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