On 16 Jul 2013, at 4:39am, Bernd Lehmkuhl <[email protected]> wrote:

> Am 15.07.2013 22:26, schrieb Simon Slavin:
>> 
>> The following two statements do different things.
>> 
>> INSERT INTO myTable VALUES (01)
>> INSERT INTO myTable VALUES ('01')
>> 
>> Can you tell what's being done in your setup ?  Is there a way using your 
>> API that you can stress that the value you're binding or inserting is text, 
>> not a number ?
> 
> As I use a parameterized query, I'm pretty certain that it should be '01' - 
> the second case. Stepping through the code in VS Debugger also shows that 
> DbType of that parameter is String and Value is '01'.

If the column in the table really is defined as TEXT, and the INSERT commands 
do have apostrophes around the values, then SQLite3 should not be losing that 
zero.

Can you open the database in some other tool (e.g. the sqlite3 command-line 
tool, available from the SQLite site) and see what the table schema says ?  
Your commands should be something like

sqlite3 myDatabaseFile
.schema
.quit

If you have lots of tables you can do ".schema mytable" instead of just 
".schema".

If you want to experiment you can manually type in an INSERT yourself, then do 
a SELECT and see whether the zeros were preserved.

Simon.

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to