I am making an app to connect to a database with few tables in it. at the moment I am attempting to make a secure login page following this page: http://www.xojo.com/blog/en/2013/09/secure-web-app-login-screens.php. I can connect to the database just fine in the rest of my app, but attempting to use this login portal is proving a bit more challenging. At the moment the compile works fine, but when I attempt to pass valid credentials the app gets stuck at checking the validity of the credentials. I am attaching a snippet of the code from the “ValidateCredentials” method I have created.
[code] dim db as new ODBCDatabase
db.DataSource = “X”
db.UserName = “X”
db.Password = “X”
dim rs as RecordSet, sql as string
sql = “select count(1) as cnt1 from sec_users where userid = '”+UserNameField.Text+"’ and password = ‘"+PasswordField.Text+"’"
rs = db.SQLSelect(sql)
if db.error then
MsgBox("Database Error: " + db.ErrorMessage)
'MsgBox(UserNameField.Text + ", " +PasswordField.Text+ ", ")
if rs.field(“cnt1”).value = 1 then
end if [/code]
The error comes on this line: " if rs.field(“cnt1”).value = 1 then" and is throwing some sort of nil object exception with the recordset.
I’m sure theres something very obvious wrong somewhere, but my eyes are not finding it. Any guidance is greatly appreciated!