jeudi 9 février 2017

Cannot find table 0 in VB Windows Forms Application

Vote count: 0

Public Class Form1 Private SQL As New SQLControl Private AuthUser As String

Private Sub cmdLogin_Click(sender As System.Object, e As EventArgs) Handles cmdLogin.Click
    If SQL.HasConnection = True Then
        If IsAuthenticated() = True Then
            AuthUser = txtUser.Text
            MsgBox("Login Successful")
        End If
    End If
End Sub

Private Function IsAuthenticated() As Boolean
    'to clear existing record
    If SQL.SQLDS IsNot Nothing Then
        SQL.SQLDS.Clear()
    End If

    SQL.RunQuery("SELECT Count(username) As UserCount " &
                 "From members " &
    "Where username='" & txtUser.Text & "' " &
    "AND password'" & txtPass.Text & "' COLLATE SQL_Latin1_General_CP1_CS_AS")

    If SQL.SQLDS.Tables(0).Rows(0).Item("UserCount") = 0 Then
        Return True
    End If

    MsgBox("Invalid User Credencials.", MsgBoxStyle.Critical, "LOGIN FAILED")
    Return False
End Function

End Class

Please let me know I am having error on this line (If SQL.SQLDS.Tables(0).Rows(0).Item("UserCount") = 0 Then) Please help me

asked 47 secs ago

Let's block ads! (Why?)



Cannot find table 0 in VB Windows Forms Application

Aucun commentaire:

Enregistrer un commentaire