Unix Technical Forum

ado net

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:49 PM
Analizer1
 
Posts: n/a
Default ado net

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





Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:32 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com