Questions tagged [idatareader]

IDataReader is a Microsoft .NET interface which can be used to read data coming from a database. Use this tag for questions about using this interface.

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.

References:

Related questions/examples:

Also see .

120 questions
0
votes
2 answers

Creating objects from IDataReader

I have created the following to create User objects with an ObservableCollection of UserModule objects called UserModules. I have approx. 100000 user records, each user could have up to 10 module records and this is taking minutes to finish. This…
Hank
  • 2,456
  • 3
  • 35
  • 83
0
votes
0 answers

Invalid attempt to call Read when reader is closed,base {System.SystemException} = {"Invalid attempt to call Depth when reader is closed."}

getting this exception while retrieving the data using data reader from stored procedure. Invalid attempt to call Depth when reader is closed.Invalid attempt to call Read when reader is closed,base {System.SystemException} = {"Invalid attempt to…
user3166404
  • 71
  • 2
  • 3
  • 8
0
votes
0 answers

Need advise on optimizing initialization of a list of items

I'm having a problem with one of my methods taking 4-5 minutes to initialize ~17,000 poco objects and filling a list with them. I'm trying to get away from paging the data in the query, so initializing the ~17,000 is needed. We are using an Oracle…
jhorton
  • 1,019
  • 3
  • 17
  • 36
0
votes
0 answers

Invalid attempt to call MetaData when reader is closed exception

I am using Microsoft Practice Enterprice data to connect a WCF to database(s). Notice that this exception is not thrown always. It's happening inside the while statement. Then if I refresh the page (resubmit the login details, MVC app that…
0
votes
1 answer

Lost in generic classes and inheritance - any anyone lead me out?

I hope this is not to complicated. I do have it working, but I wonder if that is the best it can be: I want to use the SQL Bulk Copy class, and more specific the overload that takes an IDataReader. I have my data in several List<> so I need a…
Ralf
  • 538
  • 1
  • 6
  • 17
0
votes
1 answer

ExecuteReader requires an open and available Connection. The connection's current state is connecting

I have an ASP.NET web page. It makes use of 4 BackgroundWorkers. Each bw retrieves some data from a database. The code for connecting to the database is: if (dbConnection.State == ConnectionState.Closed) { dbConnection.Open(); } DataTable dt…
Soul Slayer
  • 297
  • 1
  • 6
  • 17
0
votes
1 answer

IDataReader Issue in .Net 1.1 and .Net 4.0 for Sybase DB

I have a sybase DB which fetches results of a query properly as below... select S.ipoInternalID, clientAccount, clientPrice, clientAccountType, interestOnLoan = CASE WHEN useHIBOR = 1 then …
WPF-it
  • 19,625
  • 8
  • 55
  • 71
0
votes
2 answers

How to use string indexing with IDataReader in F#?

I'm new to F# and trying to dive in first and do a more formal introduction later. I have the following code: type Person = { Id: int Name: string } let GetPeople() = //seq { use conn = new…
User
  • 62,498
  • 72
  • 186
  • 247
0
votes
1 answer

asp.net IDataReader count situation

I know IDataReader doesnt have count option. And you cannot count the rows in datareader and go back to read it again because It only goes forward which means you cannot rewind it. The best solution that comes to my mind is do the select statement,…
Arif YILMAZ
  • 5,754
  • 26
  • 104
  • 189
0
votes
1 answer

how to iterate IDataReader or another control

I know I cannot iterate IDataReader to the end and go back to the beginning and iterate it again. So what should I do in order to iterate the data many times?
Arif Yilmaz
  • 121
  • 2
  • 4
  • 14
0
votes
1 answer

losing data when transfering SqlDataReader object to the method that needs IDataReader interface

I have a method which needs a SqlDataReader object as parameter, and i have tests where i've mocked that object, and everything worked fine. But, now i need to change that method. It should now only call new method, which has a IDataReader as…
morel
  • 1
  • 1
0
votes
1 answer

Idatareader to List

Using Linq is there a more efficient way to do this? IDataReader reader = qSeats.ExecuteReader(); var seats = new List(); using (IDataReader reader = qSeats.ExecuteReader()) { while…
aron
  • 2,856
  • 11
  • 49
  • 79
0
votes
1 answer

Inconsistent behavior using IDataReader.Read()

I'm running into an issue that is mind boggling to me. I've noticed that IDataReader.Read() is acting differently depending on how the IDbCommand.CommandText is set. In the code below - If 'AID' is set and passed to EntAgencyId(), reader.Read()…
Jacob Wyatt
  • 83
  • 1
  • 1
  • 8
-2
votes
2 answers

DataReader from objComm.ExecuteReader

I have the following code and I was wondering if anyone knew the correct way to handle this. SqlConnection objConn = new SqlConnection(ConfigurationManager.ConnectionStrings["someConnectionString"].ConnectionString); SqlCommand objComm = new…
-4
votes
1 answer

How can I add a IDataReader object to List in C#?

How can I create and add n IDataReader objects to a List?
1 2 3 4 5 6 7
8