473,403 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

GUID and uniqueidentifier

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,

Nov 15 '05 #1
2 23891
Instead of using a cast, call the Guid constructor, e.g.

Guid g = new Guid(txtID.text)
"Carl" <ca**@cb-cinc.com> wrote in message
news:05****************************@phx.gbl...
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,

Nov 15 '05 #2
Thanks,

I forgot this one... :(

Carl,
-----Original Message-----
Instead of using a cast, call the Guid constructor, e.g.

Guid g = new Guid(txtID.text)
"Carl" <ca**@cb-cinc.com> wrote in message
news:05****************************@phx.gbl...
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,

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Ilija_G | last post by:
Hi, Is there any replace for "Select @@identity" that could return "just inserted" GUID as a primary key? Has anyone tested what's faster, working with Guid or Autonumber ?
4
by: Jacques Wentworth | last post by:
Hi I have the following problem. I have a SQL Server (2000) Stored Proc that with 4 parameter (one being @UnlockKey uniqueidentifier OUTPUT). I run it from Query Analyzer and the @Key parameter...
5
by: turnstyle | last post by:
Hi all, I'm trying to run a select where a uniqueidentifier/GUID equals a hex, but I don't seem to be getting matches. For example, this query returns the expected record: select * from...
3
by: Jeffry van de Vuurst | last post by:
Hi, I'm working with Guids as the primary key of some of my tables. In my code, I'm working with those Guids. Now I was wondering what is the best way to work with Guids (in terms of...
3
by: SMG | last post by:
Hi all, I created one table with following structure, and bound the same with a DataGird. But I am not able to see any column which is having 'uniqueidentifier' as datatype. Name ...
3
by: Gopal Krish | last post by:
I need to display uniqueidentifier (GUID) from a table in SQL Server into a ASP.NET Web Page (Combo box). I'm using C#. When I tried to display GUIDs in a combo box I get "System.Byte" for all...
1
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter...
1
by: Scott M. Lyon | last post by:
I've got a stored procedure that takes a few parameters as input parameters, and one output parameter (a uniqueidentifier). After the stored procedure call, I need to return that output parameter...
8
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Vb.net 2005 app I am looking up records in a sql 2005 database and I grab the uniqueidentifier and put it into a variable (gID) of type GUID. When I try to create a new record in a new table...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.