Am 05.03.2010 15:34, schrieb Gilles Ganault:

> In the following code, a record is added everytime, although this file
> is already in the SQLite database (I checked by opening it with a
> stand-alone application after running the program once):
>
> http://pastebin.ca/1823757
>
> The problem occurs around line 63.
>
> I'm using TEXT to hold the hash column: Could it be that, for some
> reason, this data isn't reliably saved or read, which would explain
> why a new record is INSERTed every time, even though this item is
> already in the database?
>
> Thank you for any hint.
>

Hi Gilles,

I think the problem is the query, whether there is already an entry in 
the database:

SQLcommand.CommandText = "SELECT id,name,hash FROM files WHERE hash='@hash'"

The parameter probably shouldn't be put in quotes as you did. This way 
the query looks for the literal '@hash' which doesn't get replaced by 
the SQLite-ADO.NET provider and which of course doesn't exist in the db.

Hope that helps, Bernd

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

Reply via email to