Ribeyed
05-18-2007, 07:07 PM
Hi all,
anyone know how to converting a sting to GUID?
anyone know how to converting a sting to GUID?
|
Click to See Complete Forum and Search --> : String to GUID Ribeyed 05-18-2007, 07:07 PM Hi all, anyone know how to converting a sting to GUID? Ribeyed 05-19-2007, 02:32 PM hi all, worked it out :) theGUID = SqlGUID.Parse(string) however i have another problem regarding the use of GUID. I am creating a dataset will multiple tables and relationships. I am creating select, insert and update commands on my dataAdapters. I am adding a new row to my datatable then calling the Update command on my dataAdapter to insert the data into my database. I am not adding any data to my GUID column as this should be created in my stored procedure. I am outputing the primary key GUID from my stored procedure using the NEWGUID() command. i am then returning the GUID from my insert on my dataAdapter and setting to a GUID variable. When i try using the returned GUID further down in my code its a different GUID than the one in my database. lol Is the datatable creating its own GUID and returning that? Ribeyed 05-19-2007, 03:54 PM ok i know what i was doing wrong :) In my database my primary key is datatype uniqueidentifier. I was setting the isRowGUID to yes and added NEWID() as the default value. I was letting SQL Server generate the GUID on insert. In my stored procedure i has this code: Insert (column2, column3) Values (@parm2, @pram3) SET @ReturnGUID = NEWID() I was returning a New GUID and not the new one created. to fix i set the is RowGUID to no and removed the default value. i then changed my stored procedure to the following: SET @ReturnGUID = NEWID() Insert (primarykey, column2, column3) Values (@ReturnGUID , @parm2, @pram3) success! webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |