> I know the literal GUID value shown is correct, as I copied it directly from 
> the results pane when I do a SELECT * FROM UserRole, however, as soon as I 
> add the WHERE clause, I get no results.

Execute 'SELECT UserId, typeof(UserId) FROM UserRole' preferably from
sqlite command line utility and see what SQLite datatype and value is
stored in your GUID column. It will suggest you how you should use it
to make a literal value.

I bet your GUID value is stored as BLOB and whatever utility you use
to query the database recognizes GUID type in table definition and
automatically transforms it to standard string representation before
displaying.


Pavel

On Wed, Sep 22, 2010 at 4:15 PM,  <b...@altusvms.com> wrote:
> Simple question, likely to have a simple answer.
>
> I have tables in SQLite using GUID primary key columns.  I am attempting to 
> select a row based on its literal guid value in C#.Net.
>
> Here's a sample query:
>
> SELECT        Role.Id, Role.Name, Role.Description, Role.Active, Role.BitMask
> FROM            UserRole INNER JOIN
>                         Role ON UserRole.RoleId = Role.Id
> WHERE        (UserRole.UserId = '{29831334-a434-4c06-a297-b58889f4d3c6}')
>
> I know the literal GUID value shown is correct, as I copied it directly from 
> the results pane when I do a SELECT * FROM UserRole, however, as soon as I 
> add the WHERE clause, I get no results.
>
> I know there is an option to set BinaryGuid=True/False, at the connection 
> level, and I have done this both ways with the same results.
>
> Is there some other way to declare the literal guid value so that it will 
> match? (I have tried without the { } pair as well, BTW).
>
> Thanks!
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to