Top "Datareader" questions

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

Enforce only single row returned from DataReader

I seem to write this quite a lot in my code: using (var reader = cmd.ExecuteReader()) { if (reader.Read()) { result = …

c# .net ado.net sqldatareader datareader
Exception of type 'System.OutOfMemoryException' was thrown. C# when using IDataReader

I have an application in which I have to get a large amount of data from DB. Since it failed …

c# sql exception datareader using-statement
How to use datareader with null values

Say I have this class: class myclass { public int Field1{ get; set; } public int? Field2 { get; set; } //Note Field2 is …

c# null datareader
There is already an open DataReader associated with this Command which must be closed first

This is the code I have. /// <summary> /// Method calls stored procedure and fills DataSet of contacts associated with …

c# datareader
Using MySQL Data Reader

I'm not familiar with using Data Reader, i need help with the following code, i want to retrieve a single …

c# mysql datareader
Invalid attempt to Read when reader is closed

I have a common database class for my application and in that class i have a function public MySqlDataReader getRecord(…

c# mysql database datareader
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 …

datareader executereader
DataReader: Specified cast is not valid (Int32)

Why does SqlDataReader throw an exception when converting 0 to integer? ?dataReader(3) 0 {Short} Short: 0 ?dataReader.GetInt16(3) 0 ?dataReader.GetInt32(3) {"Specified cast is …

.net sqldatareader datareader
DataReader.GetFieldType returned null

In my db table Layout, there's one column whose type is hierarchyid (column index=4). When trying to set-up new environment (…

sql sql-server datareader
MySqlDataReader: DataTable.Fill(reader) throws ConstraintException

I have two tables orders and orderdetails table orders (PK = id, UNIQUE index on orderno) |id|orderno| | 1|1000 | | 2|1001 | table orderdetails (PK = …

c# mysql datareader mysql-connector mysqldatareader