Hi Emile
I’m running Mac Catalina OS
My version of Xojo is: 2019 r3.1
Jay. Here is my code that works:
[code]// set the headers here.
windowMain.passwordListbox.HasHeader = TRUE
windowMain.passwordListbox.HeaderAt (0) = “Site Name”
windowMain.passwordListbox.HeaderAt (1) = “Username”
windowMain.passwordListbox.HeaderAt (2) = “Password”
passwordListbox.ColumnAlignmentAt(0) = ListBox.Alignments.Center
passwordListbox.ColumnAlignmentAt(1) = Listbox.Alignments.Center
passwordListbox.ColumnAlignmentAt(2) = Listbox.Alignments.Center
//fill in the lisbox with the current passwords
Var dbFile As FolderItem //set database variable
Var sql as String
Var rs as RowSet // used to be recordset, but …
//this selection of the database works without flaw
dbFile = Folderitem.ShowOpenFileDialog("") // let the person choose the database. I have filtered what could be chosen
If dbFile <> Nil Then // if it exists then do the following
Var db As New SQLiteDatabase //create an instance of the database
db.DatabaseFile = dbFile
db.EncryptionKey = App.keyholder
sql = “select siteName, userName, sitePassword from passwords order by siteName asc”
Try
db.Connect //try to connect
rs = db.SelectSQL(sql)
MessageBox("Connected to " + dbFile.Name)
MessageBox ("The select sring is : " + sql)
Try
If rs <> Nil Then
For Each row As DatabaseRow In rs
windowMain.passwordListbox.AddRow
windowMain.passwordListbox.CellValueAt(windowMain.passwordListbox.LastAddedRowIndex, 0) = rs.ColumnAt(0).StringValue
windowMain.passwordListbox.CellValueAt(windowMain.passwordListbox.LastAddedRowIndex, 1) = rs.ColumnAt(1).StringValue
windowMain.passwordListbox.CellValueAt(windowMain.passwordListbox.LastAddedRowIndex, 2) = rs.ColumnAt(2).StringValue
Next
rs.Close
End If
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
End Try
Catch error As DatabaseException
MessageBox("Error: " + error.Message) //what is the error
End Try
End If[/code]
/ set the headers here.
windowMain.passwordListbox.HasHeader = TRUE
windowMain.passwordListbox.HeaderAt (0) = “Site Name”
windowMain.passwordListbox.HeaderAt (1) = “Username”
windowMain.passwordListbox.HeaderAt (2) = “Password”
passwordListbox.ColumnAlignmentAt(0) = ListBox.Alignments.Center
passwordListbox.ColumnAlignmentAt(1) = Listbox.Alignments.Center
passwordListbox.ColumnAlignmentAt(2) = Listbox.Alignments.Center
//fill in the lisbox with the current passwords
Var dbFile As FolderItem //set database variable
Var sql as String
Var rs as RowSet // used to be recordset, but …
//this selection of the database works without flaw
dbFile = Folderitem.ShowOpenFileDialog("") // let the person choose the database. I have filtered what could be chosen
If dbFile <> Nil Then // if it exists then do the following
Var db As New SQLiteDatabase //create an instance of the database
db.DatabaseFile = dbFile
db.EncryptionKey = App.keyholder
sql = “select siteName, userName, sitePassword from passwords order by siteName asc”
Try
db.Connect //try to connect
rs = db.SelectSQL(sql)
MessageBox("Connected to " + dbFile.Name)
MessageBox ("The select sring is : " + sql)
Try
If rs <> Nil Then
For Each row As DatabaseRow In rs
windowMain.passwordListbox.AddRow
windowMain.passwordListbox.CellValueAt(windowMain.passwordListbox.LastAddedRowIndex, 0) = rs.ColumnAt(0).StringValue
windowMain.passwordListbox.CellValueAt(windowMain.passwordListbox.LastAddedRowIndex, 1) = rs.ColumnAt(1).StringValue
windowMain.passwordListbox.CellValueAt(windowMain.passwordListbox.LastAddedRowIndex, 2) = rs.ColumnAt(2).StringValue
Next
rs.Close
End If
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
End Try
Catch error As DatabaseException
MessageBox("Error: " + error.Message) //what is the error
End Try
End If[/code]
Change the following line to:
dbFile = SpecialFolder.Documents.Child("theNewPPP").Child(App.theChosenDatabase)
where App.theChosenDatabase is a property of the application.
I’m thinking it is where I have the Child(App.theChosenDatabase. The file is considered a child in this, correct?
Regards