ゲージの答えを捨てるGetInfoForStudent関数が行を返さないため、結果が得られません。この場合、行数のIf文にはElse節がありません。行を追加するためにそこにいくつかのコードを入れて、それはうまくいくはずです。
Sub ShowStudentInfo()
Dim dt As DataTable = GetInfoForStudent("test", frmLogin.txtusername.Text, frmLogin.txtPassword.Text)
If dt.Rows.Count > 0 then
With dt.Rows(0)
if String.IsNullOrEmpty(.Item("Student Name")) AndAlso String.IsNullOrEmpty(.Item("Student Name")) then
frmLibrary.txtStudentID.Text = .Item("StudentID")
frmLibrary.txtLoginID.Text = .Item("LoginID")
else
frmLibrary.txtStudentName.Text = .Item("Student Name")
frmLibrary.txtStudentAddress.Text = .Item("Student address")
end if
End With
Else
'Do something here to add new row, etc.
End If
エンドサブ