dbTalk Databases Forums  

ado net

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss ado net in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Analizer1
 
Posts: n/a

Default ado net - 02-27-2008 , 04:54 PM






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);






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.