Questions tagged [oledbdatareader]

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

oledbdatareader
Filter by
Sorted by
Tagged with
8 votes
3 answers
4k views

How Does GetSchemaTable() Work?

OleDbDataReader oleDbDataReader = oleDbCommand.ExecuteReader(CommandBehavior.KeyInfo); DataTable dataTable = oleDbDataReader.GetSchemaTable(); How does GetSchemaTable() work? Where does it get its ...
user366312's user avatar
  • 16.6k
7 votes
3 answers
28k views

Get retrived records count from OleDbDataReader in C#?

I want to get the retrived records count from the OleDbDataReader in C# ? strQuery = "SELECT * FROM Table_Name" ; dbCommand = new OleDbCommand(strQuery, dbConnection); ...
Bokambo's user avatar
  • 4,386
7 votes
2 answers
12k views

Is there a way to force Microsoft.Jet.OLEDB to get date Columns in MM/DD/YYYY format from Excel?

I am having a problem with reading DateColumns from an excel sheet. Sometimes people use different date Formats and this brings a problem. Let's say when I expect 07/26/2010 from an Excel column I ...
pencilCake's user avatar
  • 52.3k
5 votes
2 answers
32k views

An OLE DB Provider was not specified in the ConnectionString. 'Provider=SQLOLEDB;

i trying to run query using C#, i am getting the following problem An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB; my code string ...
Noora's user avatar
  • 319
4 votes
2 answers
4k views

When using OleDBDataReader to select a memo field from an Access database it only returns part of the string. How can I get the whole string?

This is my code: OleDbConnection connection = new OleDbConnection( "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\\Offline.accdb;Persist Security Info=False"); connection.Open(); OleDbCommand ...
Stephen Oberauer's user avatar
4 votes
1 answer
4k views

How to make OleDb code run asynchronous?

I've seen a lot of examples for asynchronous when trying to do Web downloading/reading. But I fail to find a sample or anything for OleDb (or is there a better equivalent?), I'd like to use the new ...
Arndroid's user avatar
  • 314
4 votes
1 answer
10k views

OleDbException (0x80004005): Unknown

I have the following code (part of a Windows Form) which connects to an Excel file successfully on my machine, but on a different box it fails. var fd = new OpenFileDialog(); if (fd.ShowDialog() == ...
Ryan Gates's user avatar
  • 4,499
4 votes
1 answer
559 views

OleDbDataReader skips first record

I have the following code : OleDbDataReader xlsReader = new OleDbCommand("Select * from [" +spreadSheetName + "]", xlsFileConnection). ExecuteReader(); In the spreadSheetName ...
Vladyslav Furdak's user avatar
3 votes
2 answers
7k views

C# How to eliminate duplicate values from comboBox?

I would like to eliminate duplicates from OleDbDataReader Should be easy but I'm spinning my wheels. Any help would be appreciated! private void Database_Load(object sender, EventArgs e) ...
NOGRP90's user avatar
  • 49
3 votes
1 answer
643 views

Oledb data reader reading the deleted rows in an excel document

I'm using the OLEDB Connection to reading an excel document, that document has data up to 100 rows. but when i delete 5 rows then try to read the document again, that OLEDB reader reading up to 100 ...
Arooran's user avatar
  • 637
3 votes
1 answer
928 views

OleDB only returning DbNull, what have I done wrong?

I've got the following code: // personCount = 7291; correct value int personCount = (int)new OleDbCommand("SELECT COUNT(*) AS [count] FROM [Individual]", _access).ExecuteScalar(); List<Person> ...
Matthew Scharley's user avatar
3 votes
1 answer
299 views

reading Html file through OLEDB fails

i am trying to read html file through OLEDB reader using following code DataTable dTable; string strDataSource = ""; string strDBFile = ""; long intPos = 0; strDataSource = mstrFilePath; dTable = new ...
Rajeev Kumar's user avatar
  • 4,939
2 votes
5 answers
1k views

How to sort 30Million csv records in Powershell

I am using oledbconnection to sort the first column of csv file. Oledb connection is executed up to 9 million records within 6 min duration successfully. But when am executing 10 million records, ...
Ritthisha S's user avatar
2 votes
2 answers
7k views

OleDbDataReader.GetString Exception - Specified cast is not valid

When my C# (.NET 3.5) application attempts to access a MS Access 2007 database the OleDbReader.GetString() method is throwing an exception: Specified cast is not valid. What am I doing wrong? ...
Jim Fell's user avatar
  • 14k
2 votes
1 answer
2k views

LIKE Command Problem using OLEDBREADER and MS Access

Odd one this... The following command returns what I would expect when I run it in query window in Access 2003: SELECT * FROM Train WHERE [Days] LIKE '*3*' However when I pass this into my C# code ...
BIDeveloper's user avatar
  • 2,628
2 votes
2 answers
2k views

LIKE query on an Access database via C# always returns COUNT(*) of 0

Please look into following code: using (OleDbConnection openCon = new OleDbConnection(ConfigurationManager.AppSettings["AccessConnectioString"])) { openCon.Open(); ...
user3030342's user avatar
2 votes
1 answer
3k views

OleDbDataReader does not see data in the cell(.xlsx)

Have a really weird problem with reading xlsx file(I'm using OleDbDataReader). I have a column there that consist of the following data: 50595855 59528522 C_213154 23141411 The problem is that ...
IgorShch's user avatar
  • 159
2 votes
2 answers
212 views

Sequence is not consecutive

From my previous question I have solved how to display information from MS Access DB file. The problem is that the sequence number is messing up after I have deleted some entries which I used as ...
HelpNeeder's user avatar
  • 6,420
2 votes
2 answers
757 views

Why won't this DataAdapter insert rows into the database?

So I have a situation where I am using a SqlDataAdapter to insert rows into a table in a SQL Server 2014 database. The source of the data is an Excel spreadsheet. The insert works fine when the ...
Jacob H's user avatar
  • 2,465
2 votes
1 answer
1k views

OleDbDataReader = null

I'm currently building a program which stores messages between users in a database and returns these messages to the user when the button below gets pressed. I'm using a SQL CE database using a ...
Leon Winston's user avatar
2 votes
2 answers
409 views

Is it possible to return an OleDbDataReader object from a method?

Is it possible to return an OleDb.OleDbDataReader object from a function? If so how would you go about doing that? My current code returns the data reader object but when I try to read that object I ...
Oliver Guy's user avatar
2 votes
1 answer
2k views

reading n-th row in oledbdatareader in c#

I have a excel sheet showing employees salary details in department wise. Just I need to save these details in to MySql . When I use oledbdatareader,it reads from the first row. But I have to choose ...
Anu's user avatar
  • 905
2 votes
1 answer
2k views

How to set Access column value to 0 (default) on a new created DB column? C#

So I have read multiple posts about my question but I cant find the right solution for it. I've got a form in which a user can add a custom column to a database. This column is always of type ...
Nicolas's user avatar
  • 2,356
2 votes
1 answer
349 views

Windows indexing search - OleDbException Not Specified Error

I'm getting an exception (OleDBException: Not specified Error) when trying to search in indexed files in a folder on my D-drive (D:\TaalTipsDocumenten). I know this piece of code worked in the past (2 ...
Dennis's user avatar
  • 164
2 votes
1 answer
6k views

Read each row in a single column in a DataReader

I use while(dr.Read()){...}. But I have a problem with reading data. I have a table like this: Column1 value1 value2 value3 I want to get Value1, Value2 and Value3 I did this like so: Using ...
Emma W.'s user avatar
  • 215
2 votes
0 answers
513 views

Multiple OleDbDataReader on one connection: OK it is working in this situation

I searched the web for multiple OleDbDataReader on one OleDbConnection, but all the answers were negative, however, this code works without error. Why is that? Dim DATA_BASE_Name As String = ...
vitcaro's user avatar
  • 21
1 vote
3 answers
17k views

Access Database error:: “No value given for one or more required parameters.”

I have a datagridview. In this DGV first colum is a combobox column. I want to make, when this combobox value is selected next fild will be filled automatically from database. But there shows a error. ...
Animesh Ghosh's user avatar
1 vote
4 answers
3k views

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 ...
user avatar
1 vote
4 answers
271 views

simplify OleDbDataReader code

I made a program, that reads data in the database I use the OleDbDataReader but the problem is I have different tables, this codes works perfectly but I found it a little bit "hardcoded" or recursive ...
Pyromancer's user avatar
  • 2,469
1 vote
3 answers
15k views

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;...
Alex Gordon's user avatar
  • 59.6k
1 vote
2 answers
2k views

Datareader error while converting string to int

I am getting compile-time error at reader.GetString, any idea why? Code: using (var connection = new OleDbConnection()) { connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data ...
Sparrow vivek's user avatar
1 vote
2 answers
612 views

IndexOutOfRangeException when reading in a field from an Access Database

I'm having trouble reading values into a list from an Access Database. The values look like this: Field is called EventDistance Values are 77 77 77 77 55 112 45 46 My code looks like this: private ...
George Boulton's user avatar
1 vote
3 answers
161 views

What is the safest practical way to deal with non-required MS Access text fields in queries?

In querying MS Access, I've learned (How can I preempt a "Specified cast is not valid" exception?) that I have to query defensively where Text (string) values may be empty (or, apparently, ...
B. Clay Shannon-B. Crow Raven's user avatar
1 vote
1 answer
3k views

Clearing OleDbDataReader parameters

In order to do my stuff, I query the database (Access) to see if my data is already there. So, I'm using a OleDbDataReader. Everything is fine at this moment. Next, depending on the result of my ...
esylvestre's user avatar
  • 1,860
1 vote
1 answer
1k views

OledbDataReader function to return integer

Working in C#, I'm having trouble with a function. Function runs a query and the query is supposed to return one integer value but I'm having trouble returning it. I keep getting errors like: Unable ...
user1898629's user avatar
1 vote
1 answer
3k views

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....
Mahsa's user avatar
  • 373
1 vote
1 answer
794 views

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(...
Muhammad Rizwan's user avatar
1 vote
2 answers
860 views

Is it OK to use a DataReader after disposing the Command object?

I have created a small class of helper methods for working against a database. I'm wondering about this method: Shared Function GetReader(sql As String, con As OleDbConnection) As OleDbDataReader ...
misha256's user avatar
  • 347
1 vote
2 answers
2k views

Combo Box Items are not Visible

I have written the following code to view my score in ComboBox, and I write this all in populate() method, and I call it form load, but it shows empty combo box. Kindly tell me what's wrong it this ...
Taha Kirmani's user avatar
1 vote
2 answers
3k views

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 ...
JDV590's user avatar
  • 651
1 vote
1 answer
124 views

In VB.Net, why OleDataReader GetDecimal() function returns only integer part?

When I run following code on VB.Net (Visual Studio 2019) a get 789 and never I receive 789.1234. Decimal part il always missing ! Imports System.Data.OleDb Dim cs = "Provider=PostgreSQL OLE DB ...
schlebe's user avatar
  • 3,597
1 vote
1 answer
3k views

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 ...
user5711693's user avatar
1 vote
1 answer
825 views

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 ...
Yazmin Nizamdeen's user avatar
1 vote
3 answers
2k views

OleDbDatareader Decimal Issue

I have a tab-separated text file with some decimal values formated like that: 0,12 (comma as decimal separator). I parse its contents to an OleDBDataReader via Provider=Microsoft.Jet.OLEDB.4.0, but ...
Lombardo's user avatar
1 vote
2 answers
1k views

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" ...
Ken Richards's user avatar
  • 2,973
1 vote
3 answers
6k views

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 ...
Bhaswanth's user avatar
  • 283
1 vote
1 answer
144 views

OledbDataReader using up all the RAM (in powershell)

From all my reading, the oledb datareader does not store records in memory, but this code is maxing out the RAM. Its meant to pull data from an Oracle db (about 10M records) and write them to a GZIP ...
neuralgroove's user avatar
1 vote
0 answers
52 views

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() '...
Steven's user avatar
  • 51
1 vote
2 answers
2k views

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 ...
eaglei22's user avatar
  • 2,690
1 vote
2 answers
898 views

"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,...
Christopher's user avatar