I am built a massive set of if/else if statement to examine different
OleDbType types. I would like to make this into a switch, but that
only seems to work on Int and String. What is a better way to do this?

Thanks.

Re: Switch on OleDbType? by Tomas

Tomas
Fri Sep 02 10:54:18 CDT 2005

Hi there,

once I have solved this by evaluating yourobject.GetType().ToString(), which
returns something like "System.OleDbString" or whatever... Since this is a
string, you can use switch.

Regards


Tomas

"xenophon" <xenophon@online.nospam> píse v diskusním príspevku
news:mjsgh1dd3ise4i9np3vgc5k4lrjp7dkmjv@4ax.com...
>
> I am built a massive set of if/else if statement to examine different
> OleDbType types. I would like to make this into a switch, but that
> only seems to work on Int and String. What is a better way to do this?
>
> Thanks.
>



RE: Switch on OleDbType? by BradRoberts56nojunk

BradRoberts56nojunk
Fri Sep 02 12:03:01 CDT 2005

Example,
Dim x As Int32 = System.Data.OleDb.OleDbType.DBTimeStamp

Re: Switch on OleDbType? by Tomas

Tomas
Fri Sep 02 12:34:06 CDT 2005

That's right, I forgot this was an enum.

So the answer is - you can use switch for enums the same way as for int
values.

Like switch(myDbType) {case OleDbType.DBTimeStamp: break; case ...}


Tomas

"Brad Roberts" <BradRoberts56nojunk@hotmail.com> pí¹e v diskusním pøíspìvku
news:E48F3A93-F3D5-40AC-8209-4871C1E453A2@microsoft.com...
> Example,
> Dim x As Int32 = System.Data.OleDb.OleDbType.DBTimeStamp