In my first post only the first part of my code is visible.
When I edit the post, in the edit window all code is visible.
I have a table, I read out all values from it by a select *.
Then for each of the fields I generate a parameterized query based on the reader.FieldCount eg: if fieldcount is 4, it will be " insert into table values (?,?,?,?)"
then I use cmd.Parameters.AddWithValue(null,reader[i].ToString()); to replace these wildcards.
Here is a link to a more readable query:
http://stackoverflow.com/questions/2253830/datatype-mismatch-issue-in-a-parametrized-insert-query
Using a insert into select from statement I get malformed database error, as I have to attach a new SQLite database, and it turns out it doesn't work as supposed to. Removing .ToString() doesn't help, as for example non-null columns needs to have empty value, and the provider sends null for it. SQLite doesn't force type, but I think the provider forces it.