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
1
vote
2 answers

AutoMapper : Map a destination property to a different source property/type based on some logic

I want to map a Source object to Destination object which has some extra properties which are not directly equivalent to the source properties. Consider below example: class Source { string ImageFilePath; } class Destination { bool IsFileSelected;…
Lucifer
  • 2,317
  • 9
  • 43
  • 67
1
vote
1 answer

How do I exclude specific databases from being added to my array?

I want to exclude specific database from showing up, but the items that I excluded still show up upon running the program. There is no compilation error. private ComboBox cb; private Label label; private object[] databases; public…
Shulz
  • 508
  • 3
  • 12
  • 27
1
vote
1 answer

this expression was expected to have type IDataReader but here has type SqlDataReader

The following code is not casting my return value of SqlDataReader from getReader correctly to IDataReaderin the call to Seq.unfold. What am I doing wrong? open System.Data open System.Data.SqlClient open System.Configuration type Foo = { id:int;…
Charles Lambert
  • 5,042
  • 26
  • 47
1
vote
1 answer

IDataReader runtime error

I'm trying to populate my Request using the IDataReader but for some of the properties the values are coming back as null from the database, this then throws an exception because it doesn't like the null. public static void Populate(IDataReader…
jeffry
  • 327
  • 2
  • 8
  • 23
1
vote
1 answer

NUnit: Automapper.ConvertUsing() returns Dto with null properties

I'm using AutoMapper to map from IDataReader to a simple DTO. I'm able to map the properties when I use ForMember, but not when I use ConstructUsing/ConvertUsing. In this case, all my NUnit tests fail, because the AutoMapper returns a DTO with null…
Rita
  • 1,448
  • 1
  • 14
  • 22
1
vote
2 answers

IDataReader implementation failure with SqlCeBulkCopy

I'm trying to bulk load data from a .DAT file (output from SQL Server) to a SQL CE 4.0 file. I've been using ErikEJ's SqlCeBulkCopy class to load data perfectly from SQL Server, but from .DAT has been an issue. I created a class that implements…
MrShoes
  • 485
  • 10
  • 28
1
vote
1 answer

Using AutoMapper with DataTable with missing columns

I'm using AutoMapper to map a datatable to a List. In my scenario, the columns for the datatable may change depending on an outside variable. I can successfully map the datatable to the object w/ the…
user1147941
  • 121
  • 2
  • 16
1
vote
2 answers

Advantages of using SQLDataReader over a reader that implements IDatareader?

What are the advantages of using a SQLDataReader as opposed to a reader that just implements IDatareader if I'm using SQL Server >= 2005? Does the SQLDatareader simply have more functionality to choose from, or are there performance improvements…
Chris Burgess
  • 5,787
  • 13
  • 54
  • 69
1
vote
1 answer

IDataReader not reading, no errors

I realize IDataReader is outdated and some view it as dirty code, but on the site I am working on this is what they use. I have an IDataReader statement to run a query to get a specific id from a table using multiple joins. Now this site has a DAL…
user1469499
1
vote
1 answer

Is it possible to use an IDataReader on a DataTable or it's DataRows?

I have a function that populates an object using IDataReader: private void FillDataItem(IDataReader datareader) { this.CompanyCode = datareader.GetString(datareader.GetOrdinal("COMPANY")); this.Name =…
CptSupermrkt
  • 6,844
  • 12
  • 56
  • 87
1
vote
3 answers

Handling empty fields in csv during bulk import to database

I'm importing geocode data to our database from a csv file. I've used the following library A fast csv reader to read the csv and then using SqlBulkCopy Here's an example of the data I'm…
Neil
  • 5,179
  • 8
  • 48
  • 87
1
vote
2 answers

Powershell: Implementing an IdataReader wrapper around streamreader

I am trying to load extremely large CSV files into SQL Server using Powershell. The code also has to apply on the fly regex replacements, allow for various delimiters, EOR, and EOF markers. For maintenance, I would really like all of this logic to…
Snowdogging
  • 45
  • 1
  • 1
  • 6
1
vote
4 answers

Error reading IDataReader several times

I'm trying to load data (4 columns from 1 table) from an SQL database into a list, and have this so far List FNameList = (from IDataRecord r in myReader select (string)r["FirstName"]).ToList(); List
OSer
  • 83
  • 1
  • 5
1
vote
2 answers

Unable to cast object of type 'System.Data.DataView' to type 'System.Data.IDataReader'

I have a function (on vb.net) to get a data from a XMLWebService: Private Function GetDataSchedule() As DataTable Dim xTable As Data.DataTable xTable = xMaster.GetSchedule() 'Bind to DataTable Dim DT As New System.Data.DataTable …
mrjimoy_05
  • 3,452
  • 9
  • 58
  • 95
1
vote
1 answer

phxsoftware System.Data.SQLite DbDataReader misbehaving

The following post relates to the System.Data.SQLite data provider by phxsoftware (http://sqlite.phxsoftware.com) I have a question (and possibly a problem) with DbDataReader’s Read method and/or Visual Studio 2008. In many examples I see things…
Typhoid