Questions tagged [datareader]

A DataReader reads a forward-only stream of rows from a data source.

A DataReader reads a forward-only stream of rows from a data source. This tag is for questions about creating or using a datareader in code.

782 questions
6
votes
1 answer

Volume Yahoo Finance

What is the meaning of Volume in Yahoo Finance (web.DataReader(stock, 'yahoo', start, end))? Is it average daily trading volume or average dollar volume? Is it a number of shares or number of dollars?
Joe
  • 283
  • 2
  • 3
  • 11
6
votes
6 answers

How can I convert DataSet a to a DataReader?

How can I convert a DataSet to a DataReader?
anjum
  • 2,363
  • 6
  • 28
  • 25
6
votes
5 answers

Invalid attempt to call FieldCount when reader is closed

The error above occurs when I try to do a dataReader.Read on the data recieved from the database. I know there are two rows in there so it isnt because no data actually exists. Could it be the CommandBehavior.CloseConnection, causing the problem? I…
ClareBear
  • 1,493
  • 6
  • 25
  • 47
6
votes
2 answers

There is already an open DataReader ... even though it is not

Note: I've went through millions of questions when the issue is not disposing the reader/connection properly, or when the error is because of badly handled lazy loading. I believe that this issue is a different one, and probably related to MySQL's…
BartoszKP
  • 34,786
  • 15
  • 102
  • 130
6
votes
5 answers

What is a more efficient way to query MySQL using C#?

Based on links around the StackOverflow site (references below), I've come up with this block of code to perform queries from my C# application to a MySQL database. using (var dbConn = new MySqlConnection(config.DatabaseConnection)) { using (var…
Frank
  • 61
  • 1
  • 3
6
votes
1 answer

Storing results of a DataReader into an array in VB.NET

How can I store the results of a DataReader into an array, but still be able to reference them by column name? I essentially want to be able to clone the DataReader's content so that I can close the reader and still have access. I don't want to…
Brandon
  • 658
  • 2
  • 9
  • 19
6
votes
1 answer

convert dataReader to Dictionary

I tried to use LINQ to convert one row to Dictionary (fieldName -> fieldValue) return Enumerable.Range(0, reader.FieldCount) .ToDictionary(reader.GetName, reader.GetValue); but I received error message: Instance…
hellboy
  • 1,567
  • 6
  • 21
  • 54
5
votes
1 answer

Error: "No data exists for the row/column" using OdbcDataReader

Even though I know that there is data for the exact SQL query I'm performing, for the fact that I am doing the SQL query directly on the database, I continually get an exception saying that no data exists. My code is below: try { …
Dazzmaster1
  • 169
  • 1
  • 2
  • 8
5
votes
3 answers

Does DataReader.Close() method close the connection object when using Microsoft Application Blocks for Data Access?

I am reviewing an application that uses Microsoft Application Blocks for Data Access to interact with the database. The application calls a function and pass a query into it. The function creates a DataReader object using Data Access application…
Jacob Sebastian
  • 51
  • 1
  • 1
  • 3
5
votes
5 answers

Invalid attempt to call MetaData when reader is closed?

I'm running an if else statement off of a datareader to query table data and activate/de-activate some controls on a page. I implemented a using statement to automatically close the connection and the reader when I close the block, but I still get…
Ace Troubleshooter
  • 1,369
  • 6
  • 29
  • 43
5
votes
4 answers

DataReader ordinal-based lookups vs named lookups

Microsoft (and many developers) claim that the SqlDataReader.GetOrdinal method improves the performance of retrieving values from a DataReader versus using named lookups ie. reader["ColumnName"]. The question is what is the true performance…
philrabin
  • 809
  • 2
  • 11
  • 21
5
votes
1 answer

SQL DataReader network usage limit

I have such an idea (don't know bad or good). I have utility, which connects by reglament to SQL server and fetches some data to application. Data is simple (2 varchar text attributes), but count of data is ~ 3 millions rows. So, my application uses…
5
votes
2 answers

Intermittent System.IndexOutOfRangeException when reading a field from IDataReader

I have a very weird problem in code that I would not expect to ever fail. It is a website with some traffic but not that huge based on AspDotNetStoreFront. Site intermittently crashes when trying to read a database field from a reader. This happen…
David
  • 830
  • 3
  • 13
  • 25
5
votes
8 answers

Datareader returns no results in VS yet Stored Procedure returns multiple result sets in Sql Server

I am having trouble retrieving results from my datareader in visual studio 2008. I have several stored Procs in the same database. I am able to retrieve values from those that dont receive input parameters. However, when i use the executreReader()…
None
5
votes
2 answers

How to get multiple rows from Datareader

This is the code I have. It works fine but returns only one row. As you can see in the SQL Statement I need 2 rows returned in the datagrid that I use in the form. While the procedure reads 2 rows it only displays one row. NameAddrmark is a…
TonyM
  • 191
  • 1
  • 2
  • 7