开发者

SQLite ADO .NET: how to specify a default value for GUID?

As i previously discovered, SQLieParameter (parametrized query) can't be used for "create table" in SQLite ADO .NET. I need to create a table with GUID field and i want a default value to be all zeroes. But the following query:

create table test ( name text default 'no name', id guid default 0 )

Creates a table w开发者_运维知识库here adding an item and reading it again not reads a GUID (SQLiteDataReader.GetGuid() raises exception). Maybe anyone knows how to correctly define a default guid value for "create table" in SQLite ADO .NET?


One of these might work:

create table test ( name text default 'no name', id guid default ('00000000-0000-0000-0000-000000000000'))

create table test ( name text default 'no name', id guid default ('{00000000-0000-0000-0000-000000000000}'))

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜