أين الخطأ ؟؟
كود :
Private Sub login()
Dim objUserCls As New UserCls
If (objUserCls.Login(TxtUserName.Text, txtPassword.Text).Tables(0).Rows.Count <= 0) Then
isloginInfoRight = False
MessageBox.Show("إسم الدخول أو كلمة السر غير صحيحة")
Else
isloginInfoRight = True
strLoginName = TxtUserName.Text
Close()
End If
كود :
Private Sub logBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles logBtn.Click
login()
End Sub
كود :
Public Function Login(ByVal strUserName As String, ByVal strPassword As String) As DataSet
Dim dataSetOutput As New DataSet
Try
Using conn
'conn.Open()
Using cmd = New SqlCommand("select * from users where username=@a and password=@b", conn)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("@a", strUserName)
cmd.Parameters.AddWithValue("@b", strPassword)
adp = New SqlDataAdapter(cmd)
adp.SelectCommand = cmd
adp.Fill(dataSetOutput)
conn.Close()
End Using
End Using
Catch ex As Exception
ApplicationLogCls.WriteError(ex)
End Try
Return dataSetOutput
End Function
عند التنفيذ وإدخال اليوزر والباسوورد تأتي رسالة ( cannot find table(0))