PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET OracleDataReader field type?

Reply

OracleDataReader field type?

 
Thread Tools Rate Thread
Old 11-04-2006, 12:47 PM   #1
n4ixt
Guest
 
Posts: n/a
Default OracleDataReader field type?


I've hunted for what should be a fairly simple answer but can't find what
should be an answer to a simple question.

I have a data reader, let's say it's declared in C# as OracleDataReader dr =
new OracleDataReader();

I do my dr.Read, then access one of the columns as
dr["FirstName"].ToString() for example. Now let's say I would instead want
to pass my various fields (aka columns) to a method.

this.DoSomething(dr["FirstName"]);
this.DoSomething(dr["LastName"]);
this.DoSomething(dr["Age"]);

for example. When I declare my DoSomething:

private void DoSomething(??? myField)

what the heck do I put for ??? In the old ADO days this would have been
Field, but I cannot for the life of me figure out what the heck to put here.
I've googled, hunted thru MSDN, books, and drank three pots of coffee but
still don't have a clue. Someone hit me with a clue-stick, please.

Thanks,

Robert



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  Reply With Quote
Old 11-04-2006, 06:57 PM   #2
Aytaç ÖZAY
Guest
 
Posts: n/a
Default Re: OracleDataReader field type?

Hi,

You can use a code like this,

private void DoSomething(object x);
{

}

Because .Net Framework doesn't know that which type of a data is coming from
a DataReader that you use before. It's type is set at run time.

Have a nice work,

Aytaç ÖZAY
Software Engineer

"n4ixt" <n4ixt@notabitofspam_direcway.com> wrote in message
news:1144755837_14857@sp6iad.superfeed.net...
> I've hunted for what should be a fairly simple answer but can't find what
> should be an answer to a simple question.
>
> I have a data reader, let's say it's declared in C# as OracleDataReader dr
> = new OracleDataReader();
>
> I do my dr.Read, then access one of the columns as
> dr["FirstName"].ToString() for example. Now let's say I would instead want
> to pass my various fields (aka columns) to a method.
>
> this.DoSomething(dr["FirstName"]);
> this.DoSomething(dr["LastName"]);
> this.DoSomething(dr["Age"]);
>
> for example. When I declare my DoSomething:
>
> private void DoSomething(??? myField)
>
> what the heck do I put for ??? In the old ADO days this would have been
> Field, but I cannot for the life of me figure out what the heck to put
> here. I've googled, hunted thru MSDN, books, and drank three pots of
> coffee but still don't have a clue. Someone hit me with a clue-stick,
> please.
>
> Thanks,
>
> Robert
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet
> News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
> Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption
> =----



  Reply With Quote
Old 12-04-2006, 02:42 AM   #3
n4ixt
Guest
 
Posts: n/a
Default Re: OracleDataReader field type?

Thanks, the first pass I took at the routine I did that. I wanted something
a bit more type specific though.

I wound up refactoring and instead am passing in the DataReader and a string
with the field name and working with it in the method.

Robert

"Aytaç ÖZAY" <aytacozay@hotmail.com> wrote in message
news:u06okFZXGHA.3496@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> You can use a code like this,
>
> private void DoSomething(object x);
> {
>
> }
>
> Because .Net Framework doesn't know that which type of a data is coming
> from a DataReader that you use before. It's type is set at run time.
>
> Have a nice work,
>
> Aytaç ÖZAY
> Software Engineer
>
> "n4ixt" <n4ixt@notabitofspam_direcway.com> wrote in message
> news:1144755837_14857@sp6iad.superfeed.net...
>> I've hunted for what should be a fairly simple answer but can't find what
>> should be an answer to a simple question.
>>
>> I have a data reader, let's say it's declared in C# as OracleDataReader
>> dr = new OracleDataReader();
>>
>> I do my dr.Read, then access one of the columns as
>> dr["FirstName"].ToString() for example. Now let's say I would instead
>> want to pass my various fields (aka columns) to a method.
>>
>> this.DoSomething(dr["FirstName"]);
>> this.DoSomething(dr["LastName"]);
>> this.DoSomething(dr["Age"]);
>>
>> for example. When I declare my DoSomething:
>>
>> private void DoSomething(??? myField)
>>
>> what the heck do I put for ??? In the old ADO days this would have been
>> Field, but I cannot for the life of me figure out what the heck to put
>> here. I've googled, hunted thru MSDN, books, and drank three pots of
>> coffee but still don't have a clue. Someone hit me with a clue-stick,
>> please.
>>
>> Thanks,
>>
>> Robert
>>
>>
>> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet
>> News==----
>> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
>> Newsgroups
>> ----= East and West-Coast Server Farms - Total Privacy via Encryption
>> =----

>
>





----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off