GUID and uniqueidentifier

C

Carl

Hi,

I do have one dataset from SQL server with a field
(bound) to Textbox called txtID , this field is of type
uniqueidentifier.

From the doc, they say the equivalent is GUID in dot net,

UniqueIdentifier = Supported by the .NET Compact
Framework. =
Guid = A globally unique identifier (or GUID).

Now, when that field is display into the form, I can see
the actual value without any issue.

My trouble is how can I pas it back to one function to be
use for update.

I try to cast it to GUID with the following syntax,
(System.Guid)txtID.Text

But receive the error Cannot convert type 'string'
to 'System.Guid'

So, how do I convert this txtID Textbox into GUID or
uniqueidentifier ?

Carl,
 
B

Bret Mulvey

Instead of using a cast, call the Guid constructor, e.g.

Guid g = new Guid(txtID.text)
 

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

Top