This is a migrated thread and some comments may be shown as answers.

How to use guids in parametrized quiery

1 Answer 41 Views
Data Storage for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Glavin
Top achievements
Rank 1
Glavin asked on 20 Dec 2013, 06:52 PM
I am trying to write a parametrized query where all the objects have guids.

I have something like:

db.Get<Result>("select id, count(id) from items where id = @p1", Guidvale)

I don't know if I should be casting the guid to a string or some such because of how its actually stored in SQLite or something else.

1 Answer, 1 is accepted

Sort by
0
Bulent
Telerik team
answered on 25 Dec 2013, 09:53 AM
Hello MIchael,

Thank you for contacting us.

On database level we store Guid type values as string, that's why in this particular example you should get the string representation of Guidvale as follows: 

db.Get<Result>("select id, count(id) from items where id = @p1", Guidvale.ToString()) 

If you are going to query the database with raw SQL queries you should know that DateTime and TimeSpan values are persisted as Ticks.

I hope this was useful. 


Regards,
Bulent
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Data Storage for XAML
Asked by
Glavin
Top achievements
Rank 1
Answers by
Bulent
Telerik team
Share this question
or