473,395 Members | 1,891 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,395 software developers and data experts.

how can I get the string representation of an enumeration??

Hi, All
I have an Enumeration SqlDbType.Int, I want to convert to
"SqlDbType.Int". How to do this, thanks very much!


Nov 17 '05 #1
2 3988
The following code will show System.Data.SqlDbType.Int:

SqlDbType t = SqlDbType.Int;
string s = t.GetType().ToString() + "." + t.ToString();
MessageBox.Show(s);

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/
"Green" <so*****@yahoo.com> wrote in message
news:eV****************@TK2MSFTNGP14.phx.gbl...
Hi, All
I have an Enumeration SqlDbType.Int, I want to convert to
"SqlDbType.Int". How to do this, thanks very much!

Nov 17 '05 #2
"Green" <so*****@yahoo.com> wrote in message
news:eV****************@TK2MSFTNGP14.phx.gbl...
I have an Enumeration SqlDbType.Int, I want to convert to
"SqlDbType.Int". How to do this, thanks very much!


Hi. Use GetName():

string x = System.Enum.GetName(typeof(SqlDbType), SqlDbType.Int);

-- Alan
Nov 17 '05 #3

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

Similar topics

1
by: Andrey Brozhko | last post by:
Hi I need to represent custom type system (ints, bytes, chars, enums, bitmasks, arrays and some other types) in xml. It is easy to see how to represent enums in xml (using xs:enumeration), the...
7
by: archway | last post by:
I know you cannot have string enumerations such as: enum myStringEnum { enumItem1 = "value 1", enumItem2 = "value 2", etc } However, I was wondering whether you had ever created something...
1
by: A.M | last post by:
Hi, enum LogType :string{}; I underestand that I can't have enumeration of strings. Is there any turn around for this problem? Thanks, Ali
2
by: muesliflakes | last post by:
I have the following utility function to serialize my object to XML public static string WriteToString( object o, Type type ) { XmlSerializer serializer = new XmlSerializer( type );...
3
by: Sanjay Pais | last post by:
I know that string/char enum is not possible in c# (.NET2.0) I need to create the equivalent of this: public enum HOW_GOOD { AWESOME = "A", GREAT= "G", NOT_TOO_BAD = "N", TERRIBLE="T" }
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
6
by: Georg J. Stach | last post by:
Hello, taken I've declared an enumeration like this: enum Color{ red,green,blue }; The internal representation of Color is of type integer and it's no problem to print out their values. ...
1
by: Frank Moyles | last post by:
If I have an enumeration: enum SizeType { Tiny = 0, Small, Big, Massive, OMG };
0
by: =?Utf-8?B?TGFzdGJ1aWxkZXJz?= | last post by:
Hi all, I have a weird problem which has been causing me a headache for the last two days. I have to dynamicly generate a schema in memory and load it into a dataset in memory to be returned...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.