oledb

I cannot open .xlsx file

假如想象 提交于 2019-12-06 07:02:05
问题 I want to open an xlsx file, I have tried the below code,but neither does it open nor does it thrown any error. Can anyone throw any light upon it string path = "C:\\examples\\file1.xlsx"; string connString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\";"); OleDbConnection cn = new OleDbConnection(connString); cn.Open(); OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", cn); DataTable dt = new

The 'Microsoft.ACE.OLEDB.14.0' provider is not registered on the local machine

一笑奈何 提交于 2019-12-06 05:00:55
I have built a small WPF app that will read in XLS or XLSX files and display the contents in a datagrid. I have the XLS side of things working by using the Microsoft.Jet.OLEDB.4.0 provider. I am struggling with the XLSX side of things. I am running Windows 7 (64-bit) and have Office 2010 (64-bit) installed on my machine. I see the version 14 and 12 versions of the OLEDB in my ODBC connections. When I run my connection string it returns an error. I have read through many of the posts without any successful answers, many pointing to the version the app is running which is x86. I have tried both

Retrieve pictures from Excel file using OLEDB

一笑奈何 提交于 2019-12-06 04:30:45
问题 I have an Excel sheet with two column, one is a number , and second column have a picture. i want to read these data from c# with oledb connection, i can read number easily , but pictures is not contained in second column , so in c# i just get first column. now, how can i read the images ? i want to extract the numbers and related images from this excel sheet. 回答1: Not possible, I'm afraid. Pictures do not live in cells -- you can place them over the cell, and you can size them to look like

How to make OleDb code run asynchronous?

醉酒当歌 提交于 2019-12-06 03:07:00
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 and simplified Async and Await features of C# 5.0. This is just an example of how I use OleDb now: public void insertTafelloc(int tafelnr, string datum, string tijd) { tafelsupdate = false; try { db.cmd.Connection = db.connection; db.connection.Open(); db.cmd.CommandText = "SELECT * FROM tafels WHERE tafelnr = ? AND datum = ?"; db.cmd.Parameters.Add(new OleDbParameter("1", tafelnr)); db.cmd

Why connecting to an OLEDB is giving me an connection error

爱⌒轻易说出口 提交于 2019-12-06 00:34:37
I have the following code which is connecting to my database and retrieving some data from a table: string connectionString = "Data Provider=SQLOLEDB;Data Source=myserver;Initial Catalog=Db;Integrated Security=FALSE;user=zh;pwd=zh12;"; using (OleDbConnection connection = new OleDbConnection(connectionString)) { connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText = "SELECT [Location], [URL], [TAGS] FROM [Db].[dbo].[BOOKINGTABLE]"; command.CommandType = CommandType.Text; using (OleDbDataReader reader = command.ExecuteReader()) { menu

OLEDB with updating excel cells

故事扮演 提交于 2019-12-05 23:20:22
I wrote this method to update an excel cell: public void update(string fileName, string sheetName) { string connString = connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath(fileName) + ";Extended Properties=Excel 12.0"; try { OleDbConnection oledbConn = new OleDbConnection(connString); oledbConn.Open(); OleDbCommand cmd = new OleDbCommand("UPDATE ["+sheetName+"$B5:B5] SET F1=17", oledbConn); cmd.ExecuteNonQuery(); oledbConn.Close(); } catch(Exception ex) { Debug.Write("Error: " + ex.Message); } } I called it like this: update("test.xls", "test"); The B5 cell is

Access Database engine OLEDB in windows server 2016

爷,独闯天下 提交于 2019-12-05 21:54:19
I have an application that uses Microsoft ACE OLEDB 12.0 driver and hence I have installed 2007 Office System Driver: Data Connectivity Components in my system. I also have created SSIS packages to pull data from the excel and csv files which get's inserted into the SQL tables using the Microsoft ACE OLEDB 12.0. Below is my connection string Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myFolder\myOldExcelFile.xls; Extended Properties="Excel 8.0;HDR=YES"; I wanted to move these applications to the server environment for deployment and When I reached out to the IT for getting Office 2007

System.Data.OleDb.OleDbException: Operation must use an updateable query [closed]

允我心安 提交于 2019-12-05 19:02:13
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I'm confused. I'm trying to add a single record into an Access 2000 database using ASP.Net. However, when I try to add new record, I get the following error: Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query. Admittedly, the error message is misleading. The reason for this error message is that the process runs under an identity (usually ASP.NET) that only has read

Querying Jet Databases/Excel files with C# under x64 OS

不问归期 提交于 2019-12-05 19:01:20
So I have learned that that the Microsoft.Jet.OLEDB.4.0 data provider for querying data sources like Microsoft Access MDB files and Excel spreadsheets does not work under a Windows 64-bit operating systems. What I am now supposed to use to query against these file types in .NET 3.5 (C#) applications in order to ensure compatibility in both x86 and x64 environments? I have scoured the Internet and I cannot seem to find a straight answer on how to handle this incompatibility. I've also tried using an ODBC provider and a MSDASQL provider with no luck as they seem to throw the same exceptions as

SQL Server Linked Server to Microsoft Access

醉酒当歌 提交于 2019-12-05 18:08:40
I have tried to make use of linked servers in SQL Server 2008 by doing the following to access a Microsoft Access 2003 Table. EXEC sp_addlinkedserver access1t, 'OLE DB Provider for Jet', 'Microsoft.Jet.OLEDB.4.0', 'C:\tester.mdb' EXEC sp_addlinkedsrvlogin access1t, FALSE, Null, Admin, Null GO CREATE VIEW TI001APCE1265 AS SELECT * FROM access1t...Table1 However, I get the error: OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "access1t" returned message "Unspecified error". Msg 7303, Level 16, State 1, Procedure TI001APCE1265, Line 1 Cannot initialize the data source object of OLE