SQLite Questions

david

Member
Licensed User
Hi Erel,

I have been working on the Wasp3200 bar code scanner (Windows CE 5.0) that I mentioned earlier.

I think your work is great.

I am doing my best to work through problems on my own.

I have created a new database using the windows binary for sqlite3. Will databases created in that fashion work ok with the sql dll files that you are using.

Second, I need to execute queries to bring back one record at a time and to display the values returned in a text box. I will not be using the table.

Exactly what is the syntax for doing a select with a paramater passed after user entry?

The way it was done in Borland C++ was to create a paramater variable in the program and then pass it as: "Select Description From Products where ProductID = :tempID); You would set the :tempID before executing the query.:sign0085::sign0085::sign0085::sign0085:

I fear I may not be making myself clear.

However, the simple thing is I need to read a table by user entered paramater, read one or more values returned from the database, and update the new user entered values in another query.

No table will be involved.

Can you explain how to do this or point me to some code?

Thanks very, very much.

Regards,

David
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Any SQLite 3 database will work.
You can use a variable inside a command:
I've added apostrophes before and after the variable. These are used to handle strings with spaces. If you are expecting a number,you can remove them.
B4X:
userInput = "ProductA"
[LEFT][FONT=Courier New][COLOR=#010101]Cmd.CommandText = [/COLOR][/FONT]"Select Description From Products where ProductID = '" & userInput & "'"

[FONT=Courier New][COLOR=#010101]Reader.Value = Cmd.ExecuteReader[/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000ff]Do While [/COLOR][/FONT][FONT=Courier New][COLOR=#010101]Reader.ReadNextRow[/COLOR][/FONT]
[FONT=Courier New][COLOR=#010101]      ListBox1.Add(Reader.GetValue(0))[/COLOR][/FONT]
[FONT=Courier New][COLOR=#0000ff]Loop[/COLOR][/FONT][/LEFT]
[FONT=Courier New][COLOR=#010101]Reader.Close
[/COLOR][/FONT]
 
Top