Home All Groups Group Topic Archive Search About

How to convert 'System.String' to 'System.Guid'

Author
29 Jun 2006 8:23 PM
Arne Garvander
prm = new SqlParameter("@passkey", SqlDbType.UniqueIdentifier);
prm.Value = stringvalue;
I got this exception
Invalid cast from 'System.String' to 'System.Guid'
--
Arne Garvander
(I program VB.Net for fun and C# to get paid.)

Author
29 Jun 2006 8:28 PM
Marina Levit [MVP]
prm.Value = new Guid(stringvalue);

Show quote
"Arne Garvander" <ArneGarvan***@discussions.microsoft.com> wrote in message
news:ACDE0382-BBD1-4AC8-9D99-55445B9F6F49@microsoft.com...
> prm = new SqlParameter("@passkey", SqlDbType.UniqueIdentifier);
> prm.Value = stringvalue;
> I got this exception
> Invalid cast from 'System.String' to 'System.Guid'
> --
> Arne Garvander
> (I program VB.Net for fun and C# to get paid.)

AddThis Social Bookmark Button