|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem opening oledb connection to excel fileHere is what I am doing-- string csv_store_read = "import/" + filename; --> points to excel file string conn_excel_str; OleDbConnection obj_oledb_con; conn_excel_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath(".//" + csv_store_read) + ";Extended Properties=\"Excel 8.0;HDR=Yes;\""; obj_oledb_con = new OleDbConnection(conn_excel_str); obj_oledb_con.Open(); When I run this code my app throws an oledbexception error code -2147467259 (unspecified error) I am developing with VS 2003 trying to connect to an Excel 2003 file and running .Net v1.1.4322. Note: I do have VS 2005 w/ .Net v2.0.50727 installed on my machine but am not using this platform to develop the above application - it is strictly a .Net 1.1 app. What am I missing or doing wrong? TIA, Bill Youngman Are using excel (.xls) file or standard comma delimited file (.cvs) file?
There is a slight difference between those two formats. Waiting your reply... -- Show quoteMilosz Skalecki MCP, MCAD "Bill Youngman" wrote: > I am trying to open an excel file on my local machine and read it's contents using the OleDbConnection class in C#. > > Here is what I am doing-- > > string csv_store_read = "import/" + filename; --> points to excel file > > string conn_excel_str; > > OleDbConnection obj_oledb_con; > > conn_excel_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath(".//" + csv_store_read) + ";Extended Properties=\"Excel 8.0;HDR=Yes;\""; > > obj_oledb_con = new OleDbConnection(conn_excel_str); > > obj_oledb_con.Open(); > > When I run this code my app throws an oledbexception error code -2147467259 (unspecified error) > > > > I am developing with VS 2003 trying to connect to an Excel 2003 file and running .Net v1.1.4322. > > Note: I do have VS 2005 w/ .Net v2.0.50727 installed on my machine but am not using this platform to develop the above application - it is strictly a .Net 1.1 app. > > What am I missing or doing wrong? > > TIA, > > Bill Youngman > |
|||||||||||||||||||||||