Monday, April 16, 2007

Read Excel with C# ADO.NET

Today I got a customer requirement where they had requirement to display data from Excel to their Web Site. I had done this with other earlier versions (ASP, VB), but never tried with .NET.

I thought this to be very difficult and might took enough time to fetch and display the data on site. This can be done easily through ADO.NET in very simpler way by manipulating the ConnectionString.

Below is the code snippet:



Thanks...





Sunday, April 8, 2007

Read XML in Dataset with C#

Instead of using looong approach to open, read and parse XML, I prefer reading XML with Dataset and process as required. Reading through Dataset will load all data into DataTable and DataRow and can be parsed as reqd.

Using the standard way to read XML (see other articles in blog for reading XML with recommended method) might be good, but remembering long and many lines of code to read and parse is again tedious.

Below is the code snippet:



Thanks...