Error in opening ExcelConnection C# VS2005?

The connection string Data Source should only contain the path to your CSV file. It should not contain the CSV file name The file name is specified in the SQL statement as a table string dir = @"C:\Documents and Settings\rhlim\My Documents\Visual Studio 2005\WebSites\SoD\UploadFiles\"; string mycsv = DateTime.Now. ToString("yyyyMMddHHmmss") + strExtension; string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dir + ";Extended Properties=Text;"; OleDbCommand ExcelCommand = new OleDbCommand( "SELECT columns FROM " + mycsv, ExcelConnection).

The connection string Data Source should only contain the path to your CSV file. It should not contain the CSV file name. The file name is specified in the SQL statement as a table.

String dir = @"C:\Documents and Settings\rhlim\My Documents\Visual Studio 2005\WebSites\SoD\UploadFiles\"; string mycsv = DateTime.Now. ToString("yyyyMMddHHmmss") + strExtension; string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dir + ";Extended Properties=Text;"; OleDbCommand ExcelCommand = new OleDbCommand( "SELECT columns FROM " + mycsv, ExcelConnection).

Thanks campbell, it seems working for me. However I am having some issues when converting pipe delimited text file to . Csv files, and some columns variables kind of split into two parts and skipped to the next column, messing up the row, so I have to troubleshoot why is it so.Do you mind taking a look at my code I used for converting pipe delimited file to .

Csv file? Thank you – RUiHAO Nov 9 at 6:27 stackoverflow.Com/questions/8061307/… this is the error i'm facing currently, I have no clue why the conversion had errors in it. – RUiHAO Nov 9 at 6:50.

I strongly NOT recommend you to use OLE to access to Excel documents. There's an infinite number of glitches and bugs. In general, using sql to access the data when different cells of one column can contain different data types - is nonsense.

But even without this there are enough bugs. Use COM objects for Excel. Otherwise, you will have a hard - trust me on the floor :-).

1 Going through that, I returned to Interop faster than I thought. – MichaÅ‚ Powaga Nov 9 at 7:52 @MichaÅ‚Powaga, yeah, I have similar experiences. :-) – cockroach-eater Nov 9 at 7:58.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions