Android Question insert intodatabase queries data from textebox

angelone

Member
Licensed User
Longtime User
The values that I want to insert into the database queries are entered by user in a textebox . Which is the right syntax to include them ?

For example, ' Jane ' and ' Jones ' are the values that I should have in textbox


'insert data and the image to the database
SQL1.ExecNonQuery2("INSERT INTO Persons VALUES( NULL, 'Jane', 'Jones' ,?)", Array As Object(Buffer))
 

DonManfred

Expert
Licensed User
Longtime User
Something like this i guess (not using much with database on android)
B4X:
    SQL1.ExecNonQuery2("INSERT INTO Persons VALUES( NULL, ?, ? ,?)", Array As Object(myedit1.text, myedit2.text, Buffer))
 
Upvote 0

Lahksman

Active Member
Licensed User
Longtime User
Is it just one textbox? Because in that case you would need to split the text into different variables.
 
Upvote 0

angelone

Member
Licensed User
Longtime User
Ok, thank's a lot, it work perfect. If i want also change the Table of the database i have to do in the same way?

SQL1.ExecNonQuery2("INSERT INTO " & myesit3.text & " VALUES( NULL, ?, ? ,?)", ArrayAs Object(myedit1.text, myedit2.text, Buffer))
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Learn SQL basics!

Insert always INSERTS a new entry.
Which command is used to update one or more entries in a table?

But if you are talking about the principle of using parametrized parameters. Yes, this will work with update and delete statements as well.
 
Upvote 0
Top