PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
OracleDataReader field type?
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
OracleDataReader field type?
![]() |
OracleDataReader field type? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 =---- |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > =---- |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 =--- |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

