I have this .NET (
VB) code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myConnection As New SqlConnection(ConnectionString)
myConnection.Open()
Dim CommandText As String = "SELECT firstName FROM students Where Students.ID='" & IDinput & "' "
Dim myCommand As New SqlCommand(CommandText, myConnection)
'****this the problem, somthing is mising here******
Dim name As String = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
end sub
The SQL qurey return only one record each time (only one student name with specific ID number)
I want that variable "name" will get the value of the "firstName" filed.
How to do it??