Trying to grab info off a SQL Server and display it

I am doing a VB project for school and im trying to grab s_id (student IDs, f_name (first name), and l_name(last name) i need these to display sumwhere on my program, my program takes the college student ID and uses it to log into a class that is in the database.
so far all i got is

Dim command1 As String = ""
Dim command3 As String = ""
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As SqlDataReader

myConnection = New SqlConnection("Data Source=IS250-SWIPESERV;Initial Catalog=card;Integrated Security=True")
myCommand = New SqlCommand("SELECT s_id, f_name, l_name.swipetime AS swipetimes FROM Student_Classes INNER JOIN Students ON Student_Classes.s_id = Students.s_id INNER JOIN Attendence ON Students.s_id = Attendence.cardnum INNER JOIN Schedules ON Student_Classes.crn = Schedules.crn INNER JOIN Rooms ON Schedules.r_id = Rooms.r_id where Schedules.crn = '" & command1 & "' and convert(char(10),getdate(),110) = convert(char(10),Attendence.swipetime,110)", myConnection)
dr = myCommand.ExecuteReader
While dr.Read()
Label5.Text = dr(0).ToString
End While

I am bad at best when it comes to VB.

Any help would be much appreciated
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!