On 16.07.2013 13:26, Bernd Lehmkuhl wrote:
On 16 Jul 2013, at 4:39am, Bernd Lehmkuhl <be...@web.de> 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.
Hi Simon,

The actual table definition is :
CREATE TABLE T_VWG_ABFALLVERZEICHNIS (SCHLUESSEL String, BESCHREIBUNG String, 
BEMERKUNG String, ID_GUID String, IST_PAUSCHALIERT String, 
IST_KATEGORIE_ESK_BETRIEBSSTOF String);

SQLite version 3.7.16.2 2013-04-12 11:52:43
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select schluessel, typeof(schluessel)
    ...> from t_vwg_abfallverzeichnis
    ...> where id_guid in ('BEE7F6108F02416FA0C9D5DC777DB172', 
'6061A3864C2546C4A7DDA9FDB321459F');
1|integer
01 01|text
sqlite>

I *expected* to gain TEXT affinity through the use of System.Data.SQLite and 
it's strongly typed types (doppelt gemoppelt?), but apparently this is not 
totally effective. Maybe Joe Mistachkin can say something about that?

Bernd
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
String is not a valid type specifier for TEXT colums see http://www.sqlite.org/datatype3.html type names which result in TEXT affinity.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to