SQLite Issues

Saj

Active Member
Licensed User
In the attached code i'm trying to run SQL queries on the fly as a search string is typed in using txtSQL2_KeyPress. It seems that the txtSQL2_KeyPress event doesn't get the latest text that has been typed in - always a cycle behind. Type in 'Area' into the pink text box. Is there a way round this?
 

Attachments

  • testDB.zip
    1.8 KB · Views: 170

Saj

Active Member
Licensed User
:sign0161:

Another question: is it possible to pick up the 'Delete' key from the SIP?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can try using the TextChanged event instead. It will probably be easier:
B4X:
'obj is an Object, TextBox1ChangedEvent is an Event.
Sub App_Start
    Form1.Show
    obj.New1(false)
    obj.FromControl("textbox1")
    TextBox1ChangedEvent.New1( obj.Value,"TextChanged")
End Sub

Sub TextBox1ChangedEvent_NewEvent
    form1.Text = textbox1.Text
End Sub
 

Saj

Active Member
Licensed User
Sorry Erel, but how do I add 'obj', which library should I add it from?
 

Saj

Active Member
Licensed User
That did the trick. Thnx.

Is it possible to check that a connection to a database is already open before executing 'Open'? I get a database locked error.
 

Saj

Active Member
Licensed User
I had an error in the code, which didn't close the database connection, but generally speaking is it possible to query the current connection state of the database?

I've also found that when I leave the database connection open for a while in the background and go doing other things on different forms totally unrelated to SQL and then come back to do a query, I get "Database is not open Continue?" error even with line 'DBconnection.Close' commented out.
 
Top