dbreader

  • Thread starter Thread starter microsoft.news.com
  • Start date Start date
M

microsoft.news.com

How can I this but using the dbReader instead of the streamreader and get
all the items instead of the last one in my text file i'm populating?

this works fine:
StreamReader sr = new StreamReader("file.txt");

string lines = sr.ReadLine();
while((line = sr.ReadLine()) !=null)
{
// loops thru and writes the data to the new file
}

now i need to do the same but using a dbreader
how can I get that working? I'm using
while (dbReader.Read())
{
//loops thru but its only writing the last data item to the new file
}

what else do i need to do to get this to write all the items to the new file
instead of only the last one?








S

while ((line = sr.ReadLine()) !=null)

{
 
microsoft.news.com said:
How can I this but using the dbReader instead of the
streamreader and get all the items instead of the last
one in my text file i'm populating?

What do you mean by "dbreader"?

Is it possibly an OdbcDataReader or similar, implementing the IDataReader
interface?

Are you reading from the same text file?
this works fine:
StreamReader sr = new StreamReader("file.txt");

string lines = sr.ReadLine();
while((line = sr.ReadLine()) !=null)
{
// loops thru and writes the data to the new file
}

now i need to do the same but using a dbreader
how can I get that working? I'm using
while (dbReader.Read())
{
//loops thru but its only writing the last data item to the new file
}

what else do i need to do to get this to write all
the items to the new file instead of only the last one?

How did you populate the IDataReader to start with?

What do you mean by "items"?

What do the records look like?


// Bjorn A
 
I'm connecting to an excel file as the datasource, so I'm using
OleDbConnection and OleDbDataReader.
I need to read the excel file which is working, but when i try to populate a
new file, its only displaying the lat record it reads from the excel file.

items = dataitems/data
 
Back
Top