oledb

Reading Excel InterMixed DataType Without Modifying Registry Key

笑着哭i 提交于 2019-11-27 05:52:29
问题 I am trying to use C# to read excel file which has intermixed datatype. Below is my connection string var path = //xls location var MyConnection = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; Data Source='" + path + "';Extended Properties='Excel 8.0;IMEX=1;'"); Research taught me that the complete Extended Properties in the connection string is supposed to be Excel 8.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text However, I was informed that in connection string, the

OLE DB vs OPEN XML SDK vs Excel.interop

蓝咒 提交于 2019-11-27 05:45:32
问题 I need to read XLSX files and extract a maximum amount of content from it. Which of the API's should I use? OLE DB, open XML SDK, or Excel Interop? Which is the easiest to use? Can you retrieve all the information using one or the other? i.e, date, times, merged cells, tables, pivottables, etc. 回答1: You can try all of them and choose the one that fits you most... Depending on data you want to read, I'd suggest you to use Open XML over Interop or Ole DB. I don't know an open XML SDK, although

When reading a CSV file using a DataReader and the OLEDB Jet data provider, how can I control column data types?

五迷三道 提交于 2019-11-27 04:25:49
In my C# application I am using the Microsoft Jet OLEDB data provider to read a CSV file. The connection string looks like this: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Data;Extended Properties="text;HDR=Yes;FMT=Delimited I open an ADO.NET OleDbConnection using that connection string and select all the rows from the CSV file with the command: select * from Data.csv When I open an OleDbDataReader and examine the data types of the columns it returns, I find that something in the stack has tried to guess at the data types based on the first row of data in the file. For example, suppose

Do I need to have Excel installed to query spreadsheets using an OleDB Provider?

最后都变了- 提交于 2019-11-27 03:38:51
问题 I am working on some software that uses an OleDB to open a .xls file, query some data, and fill a dataset with the results. I am now looking at using this software on systems that do not have Excel. Will my software still be able to read the spreadsheets? This xls file contains 1000s of configuration settings that my software uses. If this setup won't work on computers without Excel, I'm guessing my next best move is to convert the xls file to an XML file and read it in using XML Services.

Writing into excel file with OLEDB

两盒软妹~` 提交于 2019-11-27 02:57:41
问题 Does anyone know how to write to an excel file (.xls) via OLEDB in C#? I'm doing the following: OleDbCommand dbCmd = new OleDbCommand("CREATE TABLE [test$] (...)", connection); dbCmd.CommandTimeout = mTimeout; results = dbCmd.ExecuteNonQuery(); But I get an OleDbException thrown with message: "Cannot modify the design of table 'test$'. It is in a read-only database." My connection seems fine and I can select data fine but I can't seem to insert data into the excel file, does anyone know how I

c# reading csv file gives not a valid path

戏子无情 提交于 2019-11-27 01:17:44
问题 I can't seem to read a .csv file using the following connection string: var fileName = string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "Uploads\\countrylist.csv"); string connectionString = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}; Extended Properties=""text;HDR=YES;FMT=Delimited""", fileName); OleDbConnection oledbConn = new OleDbConnection(connectionString); oledbConn.Open(); It gives the following error: 'D:\arrgh\arrgh\Uploads\countrylist.csv' is

OLEDB v/s ODBC [duplicate]

独自空忆成欢 提交于 2019-11-27 00:30:15
问题 This question already has an answer here: what is the difference between OLE DB and ODBC data sources? 11 answers What is the difference between OLEDB and ODBC? When do I use which and how do I know what I am looking at is a OLEDB driver v/s an ODBC driver? 回答1: OLEDB and ODBC are two different database API's. ODBC is an older standard and is actually not specific to windows - you can get Unix-based ODBC libraries. OLEDB is a COM-based API for database connections. There is a driver for

Optimal way to Read an Excel file (.xls/.xlsx)

老子叫甜甜 提交于 2019-11-27 00:12:34
I know that there are different ways to read an Excel file: Iterop Oledb Open Xml SDK Compatibility is not a question because the program will be executed in a controlled environment. My Requirement : Read a file to a DataTable / CUstom Entitie s (I don't know how to make dynamic properties/fields to an object[column names will be variating in an Excel file]) Use DataTable/Custom Entities to perform some operations using its data. Update DataTable with the results of the operations Write it back to excel file . Which would be simpler. Also if possible advice me on custom Entities (adding

Writing to excel using OleDb

浪尽此生 提交于 2019-11-26 23:33:54
问题 I am attempting to export rows of data from sql to excel but my Insert Command seems to fail every time. I have spent a good deal of time trying to create this but I have finally run up against the wall. The excel document is one that is generated by the IRS and we are not aloud to modify anything above row 16. Row 16 is the header row, and everything below that needs to be the data from sql. The header names all have spaces in them, and that seems to be where I am running into trouble.

What's wrong with these parameters?

只愿长相守 提交于 2019-11-26 23:19:05
I have an Access file with 7 fields: DocID - text - primary SourceID - text ReceivedDay - Date/Time Summary - text DueDay - Date/Time Person - text Status - Yes/No Now I want to update this file with the following code: const string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\DocMan.mdb;Persist Security Info=True"; const string InsertQuery = "INSERT Into Docs(DocID,ReceivedDay,Summary,Person,DueDay,Status,SourceID) Values(@DocID,@ReceivedDay,@Summary,@Person,@DueDay,@Status,@SourceID)"; string DocID = textBox1.Text; string SourceID = comboBox1