mardi 19 juillet 2016

Fastest way to get a row using TableAdapter

From my TableAdapter SELECT statement, I do a

SELECT StudentID FROM dbo.Student WHERE Email = @Email

And in my .vb code, I call the function out and do a for each loop like this:

Dim myStudentID As Integer

Dim myTable = StudentTableAdapter1.GetStudentID("myEmail@mail.com")
For Each myRow As DataRow In myTable.Rows
    myStudentID = myRow.Item("StudentID")
    MessageBox.Show(myStudentID)
Next

However I wish to shorten this further. Is there a way to get the row faster?

Aucun commentaire:

Enregistrer un commentaire