So I have read the information, pretty sure I have a basic grasp of what is happening… but… the results are less than encouraging.
I will post the entire set up just to make sure I got it all correct:
Window.Open
’ *****************************************************
' -- Preliminary Code --
' :--* None Defined * --:
' Primary Variable Declaration(s)
srchDbase = New SQLiteDatabase
' Function(s) / Logic...
txtProdSearch.SetFocus
Window.Properties
Name: srchDbase
Type: SQLiteDatabase
Default:
Scope: Public
Window.Method
Name: mthAddValues
Parameters:
’ *****************************************************
' -- Preliminary Code --
' :--* None Defined * --:
' Primary Variable Declaration(s)
' :--* None Defined * --:
' Function(s) / Logic...
Try
srchDbase.ExecuteSQL( "INSERT INTO virtTblProdList ( barcode, prodName, price, tax ) FROM tblProductList" )
Catch err As DatabaseException
MessageDialog.Show( "Error: " + err.Message )
End Try
Window.Method
Name: mthSetupSearchDB
Parameters:
***************************************************
' -- Preliminary Code --
' :--* None Defined * --:
' Primary Variable Declaration(s)
' :--* None Defined * --:
' Function(s) / Logic...
Try
srchDbase.Connect
Catch err as DatabaseException
MessageDialog.Show("Error: " + err.Message)
Return
End Try
// Create FTS5 table
Try
srchDbase.ExecuteSQL( "CREATE VIRTUAL TABLE virtTblProdList USING fts5( barcode, prodName, price, tax ); " )
Catch err As DatabaseException
MessageDialog.Show("Error: " + err.Message)
Return
End Try
Window.Method
Name: mthSearchByText
Parameters: strSearchParam As String
’ *****************************************************
' -- Preliminary Code --
' :--* None Defined * --:
' Primary Variable Declaration(s)
Var rowSet As RowSet //
Var strSql As String = "SELECT highlight( virtTblProdList, 0, '<', '>' ) FROM virtTblProdList WHERE virtTblProdList MATCH '" + strSearchParam + "' ORDER BY prodName"
' Function(s) / Logic...
lstBxSearchReturns.RemoveAllRows
Try
rowSet = srchDbase.SelectSQL( strSql )
Catch err As DatabaseException
MessageDialog.Show("Error: " + err.Message)
'Return
End Try
If rowSet <> Nil Then
While Not rowSet.AfterLastRow
lstBxSearchReturns.AddRow( rowSet.ColumnAt( 2 ).StringValue, rowSet.ColumnAt( 3 ).StringValue, rowSet.ColumnAt( 10 ).StringValue, rowSet.ColumnAt( 11 ).StringValue )
rowSet.MoveToNextRow
Wend
rowSet.Close
Else
End If
When I run the application and attempt to search I get the following error:
Operation cannot be completed because the database is closed.
This error happens here:
Window.Method
Name: mthSearchByText
Parameters: strSearchParam As String
at this Line --> rowSet = srchDbase.SelectSQL( strSql )
I followed the tutorial but… did I?