GUID Question

  • Thread starter Thread starter Doug
  • Start date Start date
D

Doug

I have a value that was a GUID converted to string and stored in the DB. I
need to get that value back into a Guid, how can i do that? Do something
like (System.Guid)<GUIDStringVariable> does not work. Thanks.

DOug
 
Doug said:
I have a value that was a GUID converted to string and stored in the DB. I
need to get that value back into a Guid, how can i do that? Do something
like (System.Guid)<GUIDStringVariable> does not work. Thanks.

DOug

There is a constructor for Guid that accepts a string-parameter.
A different solution could be to directly store the guid
(datatype uniqueidentifier in sqlserver)

Hans Kesting
 
I knew it was simple - have to stop working so early in the morning; my mind
doesn't work. Thanks.
 
Hans,

Ya I know - the table that I'm using the original developer created it as a
string (his code populated the GUID as a string). So sql srvr can't convert
it back to GUID once it's a string unless the table is empty. Which then
means that i won't be able to convert the id back, etc....you get the point.
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top