Questions tagged [oledbdatareader]

OleDbDataReader Class provides a way of reading a forward-only stream of data rows from a data source.

OleDbDataReader Class provides a way of reading a forward-only stream of data rows from a data source.

System.Object
. System.MarshalByRefObject
. . System.Data.Common.DbDataReader
. . . System.Data.OleDb.OleDbDataReader

Namespace: System.Data.OleDb
Assembly: System.Data (in System.Data.dll)

To create an OleDbDataReader, you must call the ExecuteReader method of the OleDbCommand object, instead of directly using a constructor.

Before you close the OleDbConnection, first close the OleDbDataReader object. You must also close theOleDbDataReader object if you plan to resuse an OleDbCommand object.For example, you cannot retrieve output parameters until after you call Close.

http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbdatareader.aspx

175 questions
1
vote
2 answers

Converting null string to date

I have searched high and low to no avail, and this is last step before completing my project so please help! Thanks in advance! The user will select an entry in a gridview, which then redirects them to a form that is populated with the data from…
JDV590
  • 651
  • 3
  • 15
  • 33
1
vote
2 answers

Preserving MS Access Row Order when using DataAdapter.Fill in C#

Here's a tricky one... I noticed in a query for my code that when I used the .NET DataAdapter.Fill method as shown below to query an Access database, the order of the records was not the "natural" order of the records (as they were originally…
Ken Richards
  • 2,937
  • 2
  • 20
  • 22
1
vote
1 answer

How to check if OleDbDataReader is empty?

This is the code i am using to select Maximum RollNo based on Class field value. But when there is no data about Class Field in Table. Then Error is generated. using (var conn = new OleDbConnection(DatabaseObjects.ConnectionString)) { …
1
vote
0 answers

Trouble closing my OleDbDataReader for MS Access Database

here's my code: 'Validation for admin: cmd = New OleDbCommand("SELECT * FROM tblSettings WHERE Admin_username=@Username AND Admin_password=@password;", conn) Try conn.Open() 'Add parameters: …
Steven
  • 51
  • 1
  • 7
1
vote
1 answer

add row to datagridview while OleDbDataReader.read()

I use C# and WindowsForms. I want to insert a record to database and then add too my gridview I test the codebellow but it dosent work. //some codes here OleDbDataReader dr = dbCommand.ExecuteReader(); while (dr.Read()) { …
Mahsa
  • 363
  • 4
  • 9
  • 24
1
vote
4 answers

DateTime null values

I have the following code that is supposed to check that a value in a data reader is not null. If it is then the method should return a null value or null DateTime for use later. private static DateTime safeGetDateTime(OleDbDataReader dr, int idx) …
user4615254
1
vote
2 answers

Large query how to return results back in sections C#/ASP.NET MVC 4

I have an application written in ASP.NET MVC 4. I have a requirement to return large results from a table accessed with oledbdatareader. I am using AJAX to return a JsonResult object that contains a List: List What I do not understand…
eaglei22
  • 2,589
  • 1
  • 38
  • 53
1
vote
2 answers

"Syntax error in FROM clause" using OleDb in C# but no error for same query in Access itself

When using the following SQL-statement within c#/OleDbCommand.ExecuteReader I get a syntax error in FROM-clause. Using exactly the same statement in MS Access directly works fine. SELECT s.idShots, s.shotdata, c.[original], s.[hash],…
1
vote
3 answers

converting resultset from OleDbDataReader into list

Consider a Winforms app connecting to a SQL Server 2008 database and running a SQL SELECT statement: string myConnectionString = "Provider=SQLOLEDB;Data Source=hermes;Initial Catalog=qcvaluestest;Integrated Security=SSPI;"; string mySelectQuery =…
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
1
vote
0 answers

Reading access database

I have written code to return values based on a search box however at times, the value entered into the search box can apply to several records within an MSAccess DB. Is there a way where I can scroll through the records that apply to the value in…
Lives
  • 51
  • 5
1
vote
1 answer

OledbDataReader getOrdinal Issue

I have some problem with the function GetOrdinal coming from the OleDb.DataReader. In my table, I have columns named with some space. I tried to call it with some [ ]: Dim dr as System.Data.OleDb.OleDbDataReader dr.GetOrdinal("[Nom truc]") but it's…
MlleStrife
  • 43
  • 1
  • 10
1
vote
3 answers

retrieve value using OleDbDataReader

Let us think my sql query is select customerDetials.custid,TestTable.col1 from CustomerDetails INNER JOIN TestTable on CustomerDetails.custid=TestTables.custid where CustomerDetails.custid>0 I wanna use OleDbDataReader to retrieve rows of this…
Bhaswanth
  • 283
  • 6
  • 14
1
vote
1 answer

OleDbDataReader, C# - What is the maximum limit of the number of rows OleDbDataReader can retrieve from an excel file?

I am using OleDbDataReader (C#) to read 93081 rows from an excel file but it doesn't seem to read all the rows. It only reads 27545 out of the 93081 rows. When I read another file which only has 15941 rows, it doesn't pose any problem and retrieves…
user5711693
  • 113
  • 5
  • 17
1
vote
1 answer

Cannot apply indexing with [] to an expression of type '...' with an OleDbDataReader

I'm getting the following error on my C# Windows Form application: Cannot apply indexing with [] to an expression of type 'ChequeRegistry.oledbDataReader' The error is on the line with the if condition using the dr data reader. How can I correctly…
1
vote
0 answers

how to select more than 255 columns from Excel using OLEDBDataReader in C#

I have the code to select the values from excel sheet. Currently the excel sheet contains 258 columns. I'm using OLDDBDatrareader to select the values from that excel.But the select query only selects the first 255 columns alone. The number of…
user2960882
  • 57
  • 1
  • 8
1 2
3
11 12