This is a discussion on ado net within the SQL Server forums, part of the Microsoft SQL Server category; --> ado net and c# 2.0 i get different versions of excell files how can i get correct version of ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| ado net and c# 2.0 i get different versions of excell files how can i get correct version of xls files select the data out of the sheets if i open them in excell and save them as 4.0 xls all works fine below is my sample code; string ConnStr; ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=d:\\junk\\Reject 596998_02262008.xls;" + "Extended Properties='Excel 8.0;HDR=NO'"; //ConnsStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\temp\\data\\jhs.xls;Extended Properties='Excel 8.0;HDR=YES;'"; //REP.031.1079 //REP.031.1078 OleDbConnection SqlConn1 = new OleDbConnection(ConnStr); OleDbCommand Cmd = new OleDbCommand(); Cmd.Connection = SqlConn1.Conn; Cmd.CommandText = "Select * From [Repmso$]"; Cmd.Connection.Open(); OleDbDataReader Reader; Reader = Cmd.ExecuteReader(); DataTable abc = new DataTable(); dvOleDbReader.ReadToTable(Reader, abc); Console.WriteLine(abc.Rows.Count); |
| Thread Tools | |
| Display Modes | |
|
|