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

How do you interate the DbType enum?

Probably a very dumb question, but how do you count the members of
DbType?

Nov 17 '05 #1
3 1591
One way to do this, I am not saying that there aren't any other maybe better
ways:

using System;
using System.Data;

namespace ConsoleApplication13
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Console.WriteLine(Enum.GetValues(typeof(System.Dat a.DbType)).GetLength(0));
Console.Read();
}
}
}

Gabriel Lozano-Morán
"Nick Weekes" <ni***********@yahoo.co.uk> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Probably a very dumb question, but how do you count the members of
DbType?

Nov 17 '05 #2

You can try
Enum.GetNames(typeof(DbType)).Length;

David.
"Nick Weekes" wrote:
Probably a very dumb question, but how do you count the members of
DbType?

Nov 17 '05 #3
Thanks Gabriel...seems obvious when you think about it, but it had been
a long day :-/

Nov 17 '05 #4

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

Similar topics

21
by: Andreas Huber | last post by:
Hi there Spending half an hour searching through the archive I haven't found a rationale for the following behavior. using System; // note the missing Flags attribute enum Color {
2
by: jiangyh | last post by:
hi there : I have a question about how to convert Type to DbType? thanks a lot. jiangyh
31
by: Michael C | last post by:
If a class inherits from another class, say Form inherits from control, then I can assign the Form to a variable of type Control without needing an explicit conversion, eg Form1 f = new Form1();...
18
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have created an enum list like this: enum myEnum : int { This = 2, That, NewVal = 10, LastItm
2
by: kevin | last post by:
using SQL SERVER 2K and VS 2003 my sp takes a text input parameter, but all ofthe character DbType enums specify a max lenght of 8,000 characters. What do I use for a Text parameter?
2
by: Peter Kirk | last post by:
Hi I have a database with an "nchar" column. How do I specify this type of column in C# when I use stored procedures? For example: IDbCommand command = ... // get the command ...
34
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code...
4
by: Chris Bordeman | last post by:
I have a DataColumn, want to derive the DbType. I can do column.GetType() but that's a system type, not a db type. How do I convert it to the corresponding type? Thanks much! Chris B.
0
by: Martin Horst | last post by:
Hi, I've got a problem with SQL update statements when I pass null values (or better let's say DbNull values) to a DbParameter derived class (in my case, I'm using an SQL Server database). When...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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...
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
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...

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.