Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi to all,

 

I have an excel where i read the information to a listview. I connect to the excel file through OleDb and put it in a OleDbDataReader.

 

Now i have 2 processes that i run with the information. The 1rst one i read each row and confirm if certain information is in the excel. Then in the 2nd process I re-read the information and transform it.

 

My problem is that in the 2nd processe i dont what to query the excel file again so i reuse the DataReader of the 1st process, but it seems that the DataReader is in the last record and does not enter in the While. So how can I "reset" the DataReader to the first record?

Posted
Hi to all,

 

I have an excel where i read the information to a listview. I connect to the excel file through OleDb and put it in a OleDbDataReader.

 

Now i have 2 processes that i run with the information. The 1rst one i read each row and confirm if certain information is in the excel. Then in the 2nd process I re-read the information and transform it.

 

My problem is that in the 2nd processe i dont what to query the excel file again so i reuse the DataReader of the 1st process, but it seems that the DataReader is in the last record and does not enter in the While. So how can I "reset" the DataReader to the first record?

 

In my opinion you can't, if you read the msdn documentation you will see that the IDatareader interface meaning also the oledbdatareader and I quote: "Provides a means of reading one or more forward-only streams of result sets obtained by executing a command at a data source, and is implemented by .NET Framework data providers that access relational databases."

 

So I think it is not possible to do so, I would recommend storing your query in a DATASET which gives you more options in that directions.

 

Greetz

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...