Questions tagged [oledbconnection]

An OleDbConnection object represents a unique connection to a data source. With a client/server database system, it is equivalent to a network connection to the server. Depending on the functionality supported by the native OLE DB provider, some methods or properties of an OleDbConnection object may not be available.

An OleDbConnection object represents a unique connection to a data source. With a client/server database system, it is equivalent to a network connection to the server. Depending on the functionality supported by the native OLE DB provider, some methods or properties of an OleDbConnection object may not be available.

An OleDbConnection object represents a unique connection to a data source. With a client/server database system, it is equivalent to a network connection to the server. Depending on the functionality supported by the native OLE DB provider, some methods or properties of an OleDbConnection object may not be available. When you create an instance of OleDbConnection, all properties are set to their initial values. For a list of these values, see the OleDbConnection constructor. You can open more than one DataReader on a single OleDbConnection. If the OLE DB provider you use does not support more than one DataReader on a single connection, the provider implicitly opens an additional connection for each. If the OleDbConnection goes out of scope, it is not closed. Therefore, you must explicitly close the connection by calling Close or Dispose, or by using the OleDbConnection object within a Using statement.

For more details: http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection%28v=vs.110%29.aspx

762 questions
23
votes
6 answers

Parsing CSV using OleDb using C#

I know this topic is done to death but I am at wits end. I need to parse a csv. It's a pretty average CSV and the parsing logic has been written using OleDB by another developer who swore that it work before he went on vacation :) CSV…
Zulfi Tapia
  • 516
  • 1
  • 4
  • 14
20
votes
1 answer

Help with a OleDB connection string for excel files

The problem i'm having is that the data adapter is looking at only the first row in each column to determine the data type. In my case the first column "SKU" is numbers for the first 500 rows then I happen to have SKU's which are mixed numbers and…
The Muffin Man
  • 19,585
  • 30
  • 119
  • 191
16
votes
6 answers

OleDbConnection gets "External component has thrown an exception."

I' m using a Windows Forms application to export data to excel. Application is built both x64 and x86. So both version of Microsoft Access Databse Engine must be installed to work the application on same computer. Firstly AccessDatabaseEngine.exe is…
Anil Kocabiyik
  • 1,178
  • 6
  • 17
  • 47
15
votes
2 answers

Excel cell-values are truncated by OLEDB-provider

I'm using the OleDbConnection class to retrieve data from an Excel 2000/2003 workbook: string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + filename + ";" + "Extended…
Tor Haugen
  • 19,509
  • 9
  • 45
  • 63
14
votes
4 answers

OLEDB connection to Access Database (accdb)

I want to make a simple application for an exercise, so it could be nice to connect to a simple database like Access (.accdb) My program looks like this: using System; using System.Collections.Generic; using System.Data; using…
Jedi
  • 397
  • 2
  • 4
  • 11
13
votes
4 answers

What is causing my OLEDbException, IErrorInfo.GetDescription failed with E_FAIL(0x80004005)

I am using an OleDbConnection, OldDbCommand, and OleDbReader against an Access database. I have a named query in the database which I am calling from the code. The query works correctly when it is ran from access. Several resources indicate the…
Keith Sirmons
  • 8,271
  • 15
  • 52
  • 75
12
votes
2 answers

Difference between Sql Connection and OLEDB Connection

What is the difference between the SQL Connection and OLEDB Connection? Is that OLEDB is common to all (also SQL Server)? To which are all Servers, OLEDB is using?
Abdul Rahman
  • 682
  • 2
  • 6
  • 20
12
votes
4 answers

How to force ADO.Net to use only the System.String DataType in the readers TableSchema

I am using an OleDbConnection to query an Excel 2007 Spreadsheet. I want force the OleDbDataReader to use only string as the column datatype. The system is looking at the first 8 rows of data and inferring the data type to be Double. The problem…
Keith Sirmons
  • 8,271
  • 15
  • 52
  • 75
11
votes
5 answers

In a C# application, should a DB Connection be created once, or everytime a SQL statement is executed?

In a C# application, should a OleDBConnection be created once, or every time a SQL statement is executed? I am looking at C# code written by someone else. Every SQL statement is preceded with the creation of an OleDbConnection object whose…
CJ7
  • 22,579
  • 65
  • 193
  • 321
11
votes
3 answers

SQLGetInfo - How to use this function

I have developed a c# application which connects to many types of database servers like Sql,Oracle,Mysql etc..Connection was established using ODBC. I need to find the server type (DBMS type) for which the connection was established, as the user…
Dah Sra
  • 4,107
  • 3
  • 30
  • 69
10
votes
4 answers

Number of query values and destination fields are not the same error

I am getting an error while inserting data into a database. The error is: "Number of query values and destination fields are not the same". Insert code: OleDbConnection vconn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data…
Sharrok G
  • 447
  • 3
  • 13
  • 27
10
votes
2 answers

SSIS Package Not Running as 32bit in SQL Server 2012

I have a package that I developed in VS2012 (using the SQL Data Tools component) which collects data from a DBF file using the VFPOLEDB provider, and puts it into a database on a SQL Server 2012 X64 server. The project containing the package has the…
Adam H
  • 193
  • 1
  • 4
  • 16
9
votes
1 answer

Best way to check OleDbConnection state

Apparently (MSDN) sometimes OleDbConnection.ResetState() does nothing, so even if the connection fails OleDbConnection.State will still be set to Open. I am looking for best workaround for this, so that when I check connection state I can avoid…
David Božjak
  • 16,887
  • 18
  • 67
  • 98
9
votes
1 answer

How to create a table before using sqlbulkcopy

I have a DBF file which I am trying to import and then write that to a SQL table. The issue I am running into is if I use SqlBulkCopy, it requires me to create the table in advance but that is not possible in my scenario as the dbf file changes…
Si8
  • 9,141
  • 22
  • 109
  • 221
9
votes
3 answers

Disable/Flush OleDbConnection Cache

I've been fighting with OleDbConnection for a while now trying to get it to not cache. Basically I am accessing a shared Access database, which is being written to from another application, and then I'm reading back values (having checked that it is…
Rudi Visser
  • 21,350
  • 5
  • 71
  • 97
1
2 3
50 51