developer155
Programmer
Hello, I am facing the following issue:
I am using DataReader to get a table from a db
Now in my app I need to reference different rows of that table (based on primary keys) many times, so I will have to go back and forth.
I found that once you do Read() on DataReader you cannot go back to the row.
Any idea if I can transfer the data from DataReader when I first create it to some data structure that will allow me to get the data from rows (based on column names, etc) like from DataReader, but will also let me go back and forth?
so do somethig like
while dr.Read() { ...move data to some data structure}
and that data structure would have the same structure as the table, like
columnname colname colname colname
primarykey field1 field2 field3
primarykey ..... ..... .....
so I can get data based on colname and primary key (like from a regular table)
thanks for any advice!!!
I am using DataReader to get a table from a db
Now in my app I need to reference different rows of that table (based on primary keys) many times, so I will have to go back and forth.
I found that once you do Read() on DataReader you cannot go back to the row.
Any idea if I can transfer the data from DataReader when I first create it to some data structure that will allow me to get the data from rows (based on column names, etc) like from DataReader, but will also let me go back and forth?
so do somethig like
while dr.Read() { ...move data to some data structure}
and that data structure would have the same structure as the table, like
columnname colname colname colname
primarykey field1 field2 field3
primarykey ..... ..... .....
so I can get data based on colname and primary key (like from a regular table)
thanks for any advice!!!