![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
I have a column named "ID" and its type is "uniqueidentifier" in SQL Server 2005 Express. this column is the primary key and its default value is "newid()" in SQL Server. I have generated a DataSet in C# that has this column but its default value is DBNull what can I do to make the default value be the return value of this function ( or I want the Id be generated by default in the DataSet)? System.Guid.NewGuid() |
#2
| |||
| |||
|
#3
| |||
| |||
|
|
becuase I am using offline Typed DataSets and the GUID field is the Primary Key of the table "Leon_Amirreza" <amirreza_rahmaty (AT) yahoo (DOT) com> wrote in message news:uhK4HNz%23GHA.4472 (AT) TK2MSFTNGP05 (DOT) phx.gbl... Thanks but this gets very tricky and sorry for the clock problem "Allan Bentsen" <Allan.Bentsen (AT) discussions (DOT) microsoft.com> wrote in message news:6FDCD5BC-DC5F-4FC9-A4E4-D23E855F651F (AT) microsoft (DOT) com... H? Leon Have you cons?dered to create the guid from code and then insert it into the table, in stead of letting the sql server generate it for you ?. Otherwise it is possible to query the table for the inserted row, and reading the guid. (if the guid isn't the primary key) Hope this helps. -- TIA /Allan "Leon_Amirreza" wrote: I have a column named "ID" and its type is "uniqueidentifier" in SQL Server 2005 Express. this column is the primary key and its default value is "newid()" in SQL Server. I have generated a DataSet in C# that has this column but its default value is DBNull what can I do to make the default value be the return value of this function ( or I want the Id be generated by default in the DataSet)? System.Guid.NewGuid() |
#4
| |||
| |||
|
|
H? Leon Have you cons?dered to create the guid from code and then insert it into the table, in stead of letting the sql server generate it for you ?. Otherwise it is possible to query the table for the inserted row, and reading the guid. (if the guid isn't the primary key) Hope this helps. -- TIA /Allan "Leon_Amirreza" wrote: I have a column named "ID" and its type is "uniqueidentifier" in SQL Server 2005 Express. this column is the primary key and its default value is "newid()" in SQL Server. I have generated a DataSet in C# that has this column but its default value is DBNull what can I do to make the default value be the return value of this function ( or I want the Id be generated by default in the DataSet)? System.Guid.NewGuid() |
#5
| |||
| |||
|
|
Thanks but this gets very tricky and sorry for the clock problem "Allan Bentsen" <Allan.Bentsen (AT) discussions (DOT) microsoft.com> wrote in message news:6FDCD5BC-DC5F-4FC9-A4E4-D23E855F651F (AT) microsoft (DOT) com... H? Leon Have you cons?dered to create the guid from code and then insert it into the table, in stead of letting the sql server generate it for you ?. Otherwise it is possible to query the table for the inserted row, and reading the guid. (if the guid isn't the primary key) Hope this helps. -- TIA /Allan "Leon_Amirreza" wrote: I have a column named "ID" and its type is "uniqueidentifier" in SQL Server 2005 Express. this column is the primary key and its default value is "newid()" in SQL Server. I have generated a DataSet in C# that has this column but its default value is DBNull what can I do to make the default value be the return value of this function ( or I want the Id be generated by default in the DataSet)? System.Guid.NewGuid() |
![]() |
| Thread Tools | |
| Display Modes | |
| |