Inject array string field to SQLlite

Hi Everyone
I try to send my array of string to sqllite db.
With join i’ve parse to a string with single quote… but how i insert it in sql statement
I know that i have to prepare the whole sql before execute, not sure how
Do i have to use SQLitePreparedStatement and define every input… over 100
Thanks

Create a second array of question marks with the same number of elements. Join that to create the sql for the prepared statement, then cycle through your data array to bind the values.

I’m on my phone so maybe someone else can post example code if you need it.

Ok i’v try that, with no luck
Maybe i’m near… maybe i’m far of solution
in fact, i don’t understand the ps.bind param

[code]Dim dbFile As FolderItem
Dim db As New SQLiteDatabase
dbFile = GetFolderItem(“Mydatabase.sqlite”)
db.DatabaseFile = dbFile

If db.Connect Then
db.SQLExecute(“BEGIN TRANSACTION;”)

Dim ps As SQLitePreparedStatement = _
db.Prepare( “INSERT INTO CLIENT (Sku1,Sku2,Sku3,Sku4,VendorProduct,RegPrice,FlyerPrice,StartDate,EndDate,UPCCode,Department,Location,Bin,Store,Event,SavedAmount,LblType,LblQty,SizeDesc,UM,PageCirc,ExtractDate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,)”)

for i as integer = 0 to PushClientCSV.Ubound-1
ps.BindType(i, SQLitePreparedStatement.SQLITE_TEXT)
next

for i as integer = 0 to PushClientCSV.Ubound-1
ps.Bind(i, PushClientCSV(i))
next

ps.SQLExecute

Else
MsgBox("BD Error: " + db.ErrorMessage)
End If
[/code]

Thanks Kem Tekinay
It work!!!..my mistake… i’ve placed a comma at the end

VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,)")

Cool.

You don’t need separate loops for BindType and Bind though.

Or better:
if you need to use your PreparedStatement only for one record you can use for the bind loop the form:

ps.Bind(i, PushClientCSV(i),  SQLitePreparedStatement.SQLITE_TEXT)

if you need to use your PreparedStatement for more than one record you can resuse your PreparedStatement so the second loop and the SqlExecute command must be in your multirecord loop