universengo
Member
Hello Friends!
I have a question as below:
I use access database file and I have 1 table as Acount with 2 Col as UserName (as Text), PassWord (as Text with Input Mask = password)
2 records as
UserName______________PassWord
Admin ______________ Admin
Guest ______________ 'empty
I make an app with 2 Object as cmbUserName and txtPassWord
I load data from USerName data to cmbUserName
My code btLogin:
If I choose Admin user with pass: Admin then Login Successfull
If I choose Guest user with pass: empty then Login Fail.
I don't know how to fix, I check log and see true all with User = Guest; pass = null but Login Fail.
Please help me!
I have a question as below:
I use access database file and I have 1 table as Acount with 2 Col as UserName (as Text), PassWord (as Text with Input Mask = password)
2 records as
UserName______________PassWord
Admin ______________ Admin
Guest ______________ 'empty
I make an app with 2 Object as cmbUserName and txtPassWord
I load data from USerName data to cmbUserName
My code btLogin:
B4X:
Dim User,Pass As String
User=cmbUserName .Value
Pass=txtPassWord.Text
If txtPassWord.Text="" Then
Pass=Null
End If
'Test data
Query="Select UserName , PassWord FROM Acount"
Dim Cursor As ResultSet
Cursor = Main.gSQL.ExecQuery(Query)
Do While Cursor.NextRow
If User=Cursor.GetString("UserName ") And Pass=Cursor.GetString("PassWord ") Then
fx.Msgbox(Main.MainForm,"Login Successfull.","Infomation")
Return
End If
Loop
Cursor.Close
fx.Msgbox(Main.MainForm,"Login Fail.","Infomation")
cmbUserName .RequestFocus
If I choose Admin user with pass: Admin then Login Successfull
If I choose Guest user with pass: empty then Login Fail.
I don't know how to fix, I check log and see true all with User = Guest; pass = null but Login Fail.
Please help me!
Last edited: