Insert String Array to DB Table

mangojack

Expert
Licensed User
Longtime User
Hi ... I have finally learnt some basic SQL to the point of possible transferring existing records from random access /text files to sql db's /tables

one set of records has 13 fields/cols . Is there a more elegant way to insert an array of strings into the table. I have tried various ways as described in other posts , but this is the only one that works.

B4X:
Dim Arr(13) As String   
'populate the array with values
   
SQL1.ExecNonQuery2 ("INSERT INTO mytable VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" , Array As Object (Arr(0), Arr(1), Arr(2), Arr(3), Arr(4), Arr(5), Arr(6), Arr(7), Arr(8), Arr(9), Arr(10), Arr(11), Arr(12)))

Also one of the string values is inserted to a column set as INTEGER.. will this cause a problem,? would it be wise just to have all columns set to TEXT and convert on extraction where neccessary.
The majority of tables contain approx 500 rows with minimal sorting / querying.

To finish I would appreciate any cautionary tips ,links I should read, regarding loss / corruption of data ect. Null Values ?? , Compacting db after numerous deletes and insertions ??

Many Thanks Cheers mj
 
Last edited:

mangojack

Expert
Licensed User
Longtime User
Thanks again Erel.. thought I tried that one, obviously not
Cheers mj
 
Upvote 0
Top