Working with Excel files using c#

During my current project I had some work of reading and writing from an Excel file.  I simply started with a Google Search :) and found many solutions, but the one provided by David Hayden was excellent Read Here.  Here I wont describe this article as its already really good, I will discuss the problem encountered in using this instead.

One major problem was to read the Excel spreadsheet at first place, David has used a connection string somewhat like:

string connectionString = @”Provider=Microsoft.Jet.
OLEDB.4.0;Data Source=Book1.xls;Extended
Properties=”"Excel 8.0;HDR=YES;”"”;

I was trying to read from an Office 2007 excel file and exceptions were encountered due to the above connection string. so I changed it to :

string connectionString = String.Format(@”Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=”"Excel 12.0;HDR=YES;”"”, this.FilePath);

where this.FilePath contains the full path of the excel file.

Changing the conn string worked like a charm and everything is working fine now.

Enhanced by Zemanta

Facebook Toolkit for Microsoft Developers

Hi All

Good News ! We the .NET developers now have an API for Facebook like the PHP geeks already have :)

Now build your own FaceBook applications with ASP.NET, ASP.NET MVC, WinForms or Silverlight !

Read More

Download the SDK

  • Facebook.dll: This is the main assembly that will be used by all applications. This has all the logic to handle communication with the Facebook application. This assembly also has specific support of XAML applications (Silverlight and WPF) to enhance the Facebook platform to make databinding and data caching easier.
  • Facebook.Silverlight.dll: This is the Silverlight version of the main assembly that will be used by all Silverlight applications. This has all the logic to handle communication with the Facebook application. This assembly also has specific support of XAML applications to enhance the Facebook platform to make databinding and data caching easier. The REST API in this assembly is Asynchronous only.
  • Facebook.Web.dll: This assembly should be used by Canvas applications. The main functionality supported in this assembly is to encapsulate the handshake between the Facebook application and a canvas application (both FBML and IFrame)
  • Facebook.Web.Mvc.dll: Provide a support building canvas applications using ASP.NET MVC. Separated from Facebook.Web.dll to avoid all developers from needing to install the MVC bits.
  • Facebook.Winforms.dll: This assembly provides support for writing Facebook applications using Winform technology. This provides a Component that wraps the API to make it easier to use from Winforms. This also contains some user controls to help display Facebook data easily.