By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,512 Members | 3,790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,512 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.