Really odd that I'd get an oledbexception but turns out that the file's handle is still with the original file. I've been searching through google and keep finding the same problem but no solutions.
Connection String:
"Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + filePath + ";" +
"Extended Properties=Excel 8.0;";
Note that...
Related Question
My code doesn't release a file handle even after I call dispose to an initialized OleDbException. Is there a way to explicitly force the program to release a file handle?
...
I'm writing a database importer from our competitors to ours database:)
I have a code generator which create Methods form import to our database like
public void Test_Import_Customer_1()
// variables
string conn;
string sqlSelect;
string sqlInsert;
int extID;
string name;
string name2;
DateTime date_inserted;
sqlSelect="sel...
I have about 160 SSIS packages that I'm trying to upgrade from 2005 to 2008.
When I run SSISUpgrade.exe on them, I get the following error messages on many of the packages:
Error 0xc0209303: ...: SSIS Error Code DTS_E_OLEDB_NOPROVIDER_64BIT_ERROR. The requested OLE DB provider MICROSOFT.JET.OLEDB.4.0 is not registered -- perhaps no 64...
I'm getting a "Unreachable code detected" message in Visual Studio at the point con.close() in my code below. Can you spot what I've done wrong?
private int chek1(String insert)
{
OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=d:\\sdb.mdb");
OleDbCommand com = new OleDbCommand("select cou...
The error:
OLE DB provider 'Microsoft.ACE.OLEDB.12.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode.
And the answers I'm seeing is a conflict between 64 bit Sql Server and 32 bit Office. Is there a way to run an openrowset on Excel into Sql Server?
insert into dbo.Fi...
To create an ODBC connection in VBA, two things are required:
Create a ODBC data source
Add references in Excel
What I'd like to know is if OLEDB has fewer requirements and is easier to implement.
...
I am looking to run SQL queries using VBA code in an Excel file. It may sound like a bad way to do things, but the purpose of this is to support legacy functionality on a project I'm working on.
I figured out how to create an ODBC connection, but it requires several steps which may be troublesome to implement on many computers, so I'm...
I want to use the OleDB interfaces directly to open a connection to a DB, create a command and executing it (for example using the ICommandText interface).
The main thing I can't find is how to create the connection and the command object and how to connect the object that implements the ICommandText to the connection.
In ADO I would ju...
I have a C# application that connects to a named SQL Express instance on the local machine using OleDBConnection:
_connection = new OleDbConnection(_strConn);
_connection.Open();
_strConn is something like this: "Provider=sqloledb;Data Source=.\NAMEDINSTANCE;Initial Catalog=dbname;User Id=sa;Password=password;"
If I debug the applica...
I am reading in an excel file with an OleDBDataAdapter. I am using a select statement to UNPIVOT the data and insert into DataSet. However, the compiler is genereating this error:
{"Syntax error in FROM clause."}
But the SQL Statement is correct as I have used it in other DB's
Here is the code:
string strConn = "Provider=Microsoft.A...
Hi,
The situation might sound a bit weird but I have to play with what I have.
There's a Win2003 64-bit server OS and a legacy application written using Visual Studio 6. The app consists of two parts: ActiveX components written in VB6 and C++ code which uses them.
I need to debug the components' code. I installed Visual Studio 6 on th...
We are using ADO to access Oracle 10g release 2, Oledb provider for Oracle 10g. We are facing some issue with the connection pooling. The database reside on the remote machine and connection pooling is occuring as it should. But if the remote machine goes down for some reason, the connection is returned from the pool and query on that co...
hi guys
I am working with C# windows application
and I am facing a problem with OLEDB connection to SQL SERVER 2008
my code is too simple:
I am trying to fill the datagridview from this query
string connString = "Provider=SQLOLEDB;Data Source=servername;Initial Catalog=DBname;Integrated Security=SSPI";
string query = "SELECT * ...
Hi all.
Can anybody help me?
How can I read only first row from an Excel file with OleDbDataAdapter?
I know how I can read all data from any spread sheet:
var dataAdapter = new OleDbDataAdapter("SELECT * FROM [" + sheetName + "$]", oledbConnection);
But I don't know how can I do this for one row.
...
I have an Excel workbook which contains a PivotCache I would like to use as a data source.
var file = @"Foo.xls";
var excel = new Excel.Application();
var workbook = excel.Workbooks.Open(file);
Excel.PivotCache cache = null;
foreach (Excel.PivotCache pivotCache in workbook.PivotCaches())
{
if (...)
{
cache = pivotCache;...
Hello;
I'm trynig to connect to a database, but I get this error :
Failed IErrorInfo.GetDescription with
E_FAIL (0x80004005)
Dim ReqTest As String
Dim MR As OleDbDataReader
Dim cne, idc As Integer
ReqTest = "SELECT * FROM READ"
MR = Connexion.lecture(ReqTest)
MR.Read()
With :
Public Shared Function lecture(ByVal requete As St...
I'm using ICommandText::GetCommandText method.
According to the MSDN documentation (http://msdn.microsoft.com/en-us/library/ms709825(v=VS.85).aspx) I need to use IMalloc::Free to release the memory allocated for LPOLESTR *ppwszCommand output parameter.
How do I use this interface to do that?
...
We are making a fairly serious application that needs to remain agnostic to the DB a client wants to use. Initially we plan on supporting MySQL, Oracle & SQL Server. The tables & views are simple as are the queries (no real fancy SQL), therefore the question:
Use native DB drivers (MySQLDbConnection etc.) and encapsulate the logic of e...
I'm using the OleDB DataReader to get data from my excel files (but this problem occurs in DataTable.Fill as well). The thing is that I have a column that should return strings. All's fine and working but recently, an issue came up, because the column's cells had different formats. Some were in numbers and others in text. When I checked ...