473,508 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to display sql server uniqueidentifier (GUID) in a combo box in ASP.NET

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 the items in the combo box.

Code :

ddSeverity.DataSource = A dataset is returned here;
ddSeverity.DataValueField = "Name";
ddSeverity.DataTextField = "Severity_ID";
ddSeverity.DataBind();

"Severity_ID" is actually a GUID (Uniqueidentifier) in a SQL server
table.

I need to display the GUIDS as hex values in the web page (Just as the
GUIDS are show as hex values in Query Analyzer) but its not showing
anything other than "System.Byte[]".

Any help is much appreciated.

Thanks
Gopal
Nov 18 '05 #1
3 7777
wl
Probably there is a a better solution, but it looks you could do a cast in
the query:

select cast (MyguidField as varchar(40)) ...
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
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 the items in the combo box.

Code :

ddSeverity.DataSource = A dataset is returned here;
ddSeverity.DataValueField = "Name";
ddSeverity.DataTextField = "Severity_ID";
ddSeverity.DataBind();

"Severity_ID" is actually a GUID (Uniqueidentifier) in a SQL server
table.

I need to display the GUIDS as hex values in the web page (Just as the
GUIDS are show as hex values in Query Analyzer) but its not showing
anything other than "System.Byte[]".

Any help is much appreciated.

Thanks
Gopal

Nov 18 '05 #2
Hi GOpal
Can you please tell me how u r getting the values from the database.As u
said i am not getting any error or "System.Byte[]" .
check how ur getting values from the database.
I have created table with Unique Identified gettig data into dataset and
binding ...displaying properly...

"Gopal Krish" wrote:
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 the items in the combo box.

Code :

ddSeverity.DataSource = A dataset is returned here;
ddSeverity.DataValueField = "Name";
ddSeverity.DataTextField = "Severity_ID";
ddSeverity.DataBind();

"Severity_ID" is actually a GUID (Uniqueidentifier) in a SQL server
table.

I need to display the GUIDS as hex values in the web page (Just as the
GUIDS are show as hex values in Query Analyzer) but its not showing
anything other than "System.Byte[]".

Any help is much appreciated.

Thanks
Gopal

Nov 18 '05 #3
Hi,

This works but the guid displays as junk characters in the drop down.
I need to figure out a way to convert the guid to hex value while
reading it from the sql sever and then figure out a way to convert the
hex value to guid when sending it back to the sql server.

Any thoughts will be very helpful.

"wl" <so***@nospam.nospam> wrote in message news:<e7**************@TK2MSFTNGP11.phx.gbl>...
Probably there is a a better solution, but it looks you could do a cast in
the query:

select cast (MyguidField as varchar(40)) ...
"Gopal Krish" <ge*****@yahoo.com> wrote in message
news:8b**************************@posting.google.c om...
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 the items in the combo box.

Code :

ddSeverity.DataSource = A dataset is returned here;
ddSeverity.DataValueField = "Name";
ddSeverity.DataTextField = "Severity_ID";
ddSeverity.DataBind();

"Severity_ID" is actually a GUID (Uniqueidentifier) in a SQL server
table.

I need to display the GUIDS as hex values in the web page (Just as the
GUIDS are show as hex values in Query Analyzer) but its not showing
anything other than "System.Byte[]".

Any help is much appreciated.

Thanks
Gopal

Nov 18 '05 #4

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

Similar topics

3
2174
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
2075
by: Kenneth Keeley | last post by:
Hi, I am trying to get the results out of an SQL database where the Id is equal to a given value. The Id field is a uniqueidentifier this is what I am trying to do. SQLQuery = new...
1
9115
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
3041
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
4463
by: Vish | last post by:
Hi All, I am trying to insert a GUID generated in .NET into my SQL Server tables. I am inserting it into a column of type uniqueidentifier. The GUID generated by ..NET has lower case alphabets...
3
5297
by: Steve | last post by:
Hi All Can someone help get the rowGUID value after an insert I am using VB.net 2005 and SQL server Express 2005 The column GUID is an uniqueidentifier column with default value...
2
7171
by: bob.speaking | last post by:
Hi at all, I'm trying to bulk insert a uniqueidentifier column from unicode file. In my file I have guid generated from c# application and they are formatted in this way (separated by "|") : ...
5
6673
by: DotNetNewbie | last post by:
Hi, I am developing an application that has to scale and be very efficient, and I am using asp.net membership in my application. I set things up in my Users table (it has extra columns that I...
8
7928
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
7114
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
7377
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...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7488
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...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.