Hi all,
I am fairly new to Databases (as you will clearly see) and I am more in exploratory mode at the moment.
I am trying to create a simple login window and want to compare two rows to open a second window.(again, just exploring. I will be looking at salt and hash next. I also do not intend to use this in an actual application.)
at the moment, I have my database set up and connected. The code in the open event of the window is as follows.
Var dbFile As FolderItem
dbFile = SpecialFolder.ApplicationData.child("BBPW.sqlite")
If dbFile.Exists Then
DB = New SQLiteDatabase
DB.DatabaseFile = dbFile
db.EncryptionKey = "howdy+doody"
If DB.Connect Then
Try
db.Connect
Catch error As DatabaseException
MessageBox("Connection error: " + error.Message)
End Try
End If
Else
DB = New SQLiteDatabase
DB.DatabaseFile = dbFile
If DB.CreateDatabaseFile Then
Var SQL As String
SQL = "CREATE TABLE TestDB (ID INTEGER, Username TEXT, Password TEXT, PRIMARY KEY(ID));"
Try
db.Connect
db.Encrypt("howdy+doody")
DB.ExecuteSQL(SQL)
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
End Try
End If
End If
In another window I create the Username and Password to be stored in the database. (This works fine)
This is as far as I have gotten, I have tried to retrieve the Username and password using the following code in the action event of a button.
Textfield1.Text // Username
Textfield2.text // Password
Var rs As RowSet
Var ds As RowSet
Var User As String = TextField1.text
Var Pword As String = Textfield2.text
Try
rs = db.SelectSQL("Select * From TestDB Where Username =", User)
ds = db.SelectSQL("Select * From TestDB Where Password =", Pword)
if rs = ds then // This is my attempt at trying to compare the rows =(
MainWindow.show
login.close
end if
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
End Try
This compiles but I get the below error when clicking the button after inputting the stored Username and Password
Error: Incomplete Input.
Could anyone offer any guidance or point me in the right direction?
Again I must stress, This is just me exploring, I do not intend to use this in an actual application without Salt and Hash, I just wish to learn how to compare the two rows.
I hope I haven’t babbled on too much, please let me know if you need any more information.
Thank you all in advance!
Robin