oledb

c# reading csv file gives not a valid path

放肆的年华 提交于 2019-11-28 06:20:54
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 not a valid path. Make sure that the path name is spelled correctly and that you are connected to the

Check if column exists in OleDb table

半世苍凉 提交于 2019-11-28 05:46:25
问题 I am trying to check if a column exists and if not, add it. I've tried a couple of solutions including this, but the syntax isn't correct for Access db. This is what I have so far: public void Update(string task, string dbPath, string tableName = "Frames") { OleDbConnection db = new OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;data source=" + dbPath); db.Open(); OleDbCommand command = db.CreateCommand(); command.CommandText = "COL_LENGTH('Frames','SetNumber')"; Debug.WriteLine(command

SQL Server Destination vs OLE DB Destination

有些话、适合烂在心里 提交于 2019-11-28 05:43:32
问题 I was using OLE Db destination for Bulk import of multiple Flat Files. After some tuning I ended up with SQL Server Destination to be 25 - 50 % faster. Though I am confused about this destination as there are contradictory information on the web, some are against it, some are suggesting using it. I would like to know, are there any serious pitfalls before I deploy it to production? Thanks 回答1: In this answer, I will try to provide information from official documentation of SSIS and I will

OLEDB Import of CSV to VB.NET datatable reading '-' as 0

偶尔善良 提交于 2019-11-28 05:13:59
问题 Greetings helpful delightful people, I have a problem with reading CSV files and converting to datatables in VB.Net. If the CSV file contains a column full of '-' then on import into the datatable they appear as '0' and the entire column is formatted in a numeric format. The code I have written is: Public Function LoadCsvFile(filePath As String) As DataTable Try DTReadCSV = New DataTable Dim connection As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection("Provider

Quick ways to test OLE DB Connection String

混江龙づ霸主 提交于 2019-11-28 04:39:35
For debugging purpose I'd like to know ways to test OLE DB connection string quickly. I've found this free software , it works on my machine, tested successfully. Is there a even quicker way to do so, maybe from command line on Windows? Because most of the time, it is the client rather than me that would do this task, so I prefer a "zero-installation" approach that would impact their system the least. If the client has PowerShell installed (a given if they are running Windows 7 or Windows Server 2008 R2), then you can execute these commands from a PowerShell console window: $conn = New-Object

OLEDB v/s ODBC [duplicate]

一世执手 提交于 2019-11-28 04:34:39
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? 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 wrapping ODBC with an OLEDB front-end if the database you are using does not come with a native OLEDB driver.

OLEDB, Writing Excel cell without leading apostrophe

≡放荡痞女 提交于 2019-11-28 04:14:52
问题 I'm writing to Excel file using OLEDB (C#). What I need is just RAW data format. I've noticed all cells (headers and values) are prefixed by apostrophe (') Is it a way to avoid adding them in all text cells? Here is my connection string: string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties='Excel 8.0;HDR=Yes'"; I've tried use IMEX=1 like this: string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + "

C# Excel file OLEDB read HTML IMPORT

眉间皱痕 提交于 2019-11-28 04:13:17
问题 I have to automate something for the finance dpt. I've got an Excel file which I want to read using OleDb: string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=A_File.xls;Extended Properties=""HTML Import;IMEX=1;"""; using (OleDbConnection connection = new OleDbConnection()) { using (DbCommand command = connection.CreateCommand()) { connection.ConnectionString = connectionString; connection.Open(); DataTable dtSchema = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,

How to resolve “Could not find installable ISAM.” error for OLE DB provider “Microsoft.ACE.OLEDB.12.0”

喜欢而已 提交于 2019-11-28 02:35:04
问题 I am trying to import data from Excel 2007 (.xlsx) files into SQL Server 2008 using a T-SQL OpenRowset() command with the "Microsoft.ACE.OLEDB.12.0" OLE DB provider, and I'm getting a persistent "Could not find installable ISAM" error. All hardware is 32-bit. [Revised 1/10/12 to try to focus more sharply on the anomalies] The following T-SQL statement produces the error: SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Data Source=C:\work\TestData.xlsx;Extended Properties="Excel 12.0 XML

How To Use OleDb To Create Excel Database

社会主义新天地 提交于 2019-11-28 02:19:34
问题 My task is to take an Access Database and create an Excel file, but I can not seem to CREATE the Excel file that OleDb will use. The Excel file name will be provided by the Engineer running the tool. Each Data Table in the Access Database will become a WorkSheet in the Excel file. Right now, I have one hurtle I can not get over: If the Excel file does not exist, I cannot create it! internal const string XL_FMT = "Provider=Microsoft.{0}.OLEDB.{1};Data Source={2};Mode=ReadWrite;Extended