473,324 Members | 2,254 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,324 software developers and data experts.

datareader question

i will select over 30 fieldsname from myTable.
If i use datareader, my way to get the result is (loop - the datareader)
and strResult = myReader.getstring(12) .
Can I use the itemname to get the result ??/
Thanks
Nov 20 '05 #1
3 952
Reader.Item("Column_name")

Or

Reader("Column_name")

Don't think there's any differance really.. depends on what you think its
easier to read I guess!

But When you use GetString.. you can't really use the columnnames and you
are stuck with typing the ColumnIndex.. and sometimes that's bad if you
would to change the number or order of columns in the database..

/Lars Netzel




"Agnes" <ag***@dynamictech.com.hk> skrev i meddelandet
news:OX***************@tk2msftngp13.phx.gbl...
i will select over 30 fieldsname from myTable.
If i use datareader, my way to get the result is (loop - the datareader)
and strResult = myReader.getstring(12) .
Can I use the itemname to get the result ??/
Thanks

Nov 20 '05 #2
Hi,

strResult = myReader.item("MyField").tostring

Ken
----------------------

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:OX***************@tk2msftngp13.phx.gbl...
i will select over 30 fieldsname from myTable.
If i use datareader, my way to get the result is (loop - the datareader)
and strResult = myReader.getstring(12) .
Can I use the itemname to get the result ??/
Thanks

Nov 20 '05 #3
Hi Agnes,
i will select over 30 fieldsname from myTable.


In this kind of operations I create first a table of names and use that in a
loop or loops

I hope this helps?

Cor
Nov 20 '05 #4

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

Similar topics

14
by: Jacko | last post by:
Hi guys, Say I made a SELECT statement to my sql DB that would return 50 rows that I will use a sqldatareader to access. Instead of iterating through each and every row of the datareader, I'd...
12
by: Thomas Scheiderich | last post by:
I have 2 dropdowns that are exactly the same and I don't want to re-read for each. Is there a way to do something like below where I read the data, bind to depCity1 and then bind to destCity2. ...
20
by: Mark | last post by:
Hi all, quick question , a DataView is memory resident "view" of data in a data table therefore once populated you can close the connection to the database. Garbage collection can then be used to...
6
by: Kalim Julia | last post by:
Is it possible to open more than 1 datareader / dataadapter on one connection ? Is it possible to duplicate / clone connection ?
7
by: Varangian | last post by:
Hi all, the question I want to ask if the conversion of a DataReader to a Table looping through the DataReader is better than using the Fill Method of the DataAdapter... I'm asking because...
6
by: dejavue82 | last post by:
This is the result of a JOINed query: question answer 1 a1 1 a2 1 a3 1 a4 2 a1 2 a2
20
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
4
by: Piotrekk | last post by:
I have a question related to DataReader Suppose a lot of the data is being retrieved from database. To make use of the advantage of datareader over dataset this data should be transferred in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.