Question How to retrieve values from the database.

imsreejith

New member
Joined
Jun 7, 2012
Messages
1
Programming Experience
Beginner
Dear all,

i am new to vb.net and dont have any idea about using datareader.
i am right now doing a project on vb.net and am facing an issue.
i have a form, where in i have to select the matching records from the database and show it in various textfields. as far as the query execution is concerned, i have successfully completed it, but i am facing an issue now.
Suppose, i have an Id of a student, and he has registered for 3 courses, when i give the query something like :-
select students.studentid,courseid,midtermmarks,finaltermmarks from marks,students where students.studentid=course.studentid;
it gives me multiple records.
my doubt is, when i get multiple records, and which is true(in the case a student has registered for multiple courses), how can i traverse through the resultset and fetch the values in the respective textfields.


Regards,
Sreejith
 
You would populate a DataTable, bind that to a BindingSource and bind that to your controls. You can then use a BindingNavigator or your own code to navigate through the data. You might like to follow the Data Walkthroughs link in my signature as it will cover this and various other topics.
 
Back
Top