[X]

asp.net SQL server - import export excel worksheet using ado.net

Import/Export E worksheet using ADO.Net

Excel is very known format for storing small amount of data. So you may want your data residing in ms sql or oracle or any other data source do be exported because of any of the following reason:

  • Running calculation to derive the wanted information
  • Doing some statistical computation like MEAN, MEDIAN, MODE
  • Filtering/Sorting
  • Generating Graphical report
  • Making use of PivotTable and PivotChart

Apart from above listed one there exists also lots of other reasons to export data in excel format. Similarily we can use excel to do bulk import of data and put it into sql server database. It is very easy and faster to do data entry in excel sheet and then import those data to rdbms system.

Export to Excel from SQL Server:

There are may ways we can read data from sql server and export to excel sheet like using third party controls, binding data to some data controls and then exporting using "GridView.RenderControl()" method.

But here I am going to show how to export from sql server to ms excel using ado.net.

1. Create an asp.net website project named "ExcelExportImport" and 2 folders to it "DownloadFiles" and "UploadFiles".

2. Download AdventureWorksLT2008 database and attach ot your sql server database. More...

WolframAlpha - Computational Knowledge Engine

Computational Knowledge Engine

Today I was googling to find comparison data between "India" and "USA". I wanted to know all the important data including demographics on a single page and in a comparison chart.

While trying to find some comparison result I browsed wikipedia and google for term "India vs USA". Then I came to know about a site "www.wolframalpha.com" which is in initial phase of their engine.

WolframAlpha is termed as "computational knowledge engine" by their developer and promoter. They have a very good knowledge base data which includes topics like:

  • Mathematics
  • Statistics
  • Physics
  • Chemistry
  • Materials
  • Engineering
  • Astronomy
  • Earth Sciences
  • Life Sciences
  • Computational Sciences
  • Units and Measures
  • Dates and Times
  • Weather
  • Places and Geography
  • People and History
  • Culture and Media
  • Music
  • Words and Linguistics
  • Sports and Games
  • Colors
  • Money and Finance
  • Socioeconomic Data
  • Health and Medicine
  • Food and Nutrition
  • Education
  • Organizations
  • Transportation
  • Technological World
  • Web and Computer Systems

So if you want to know about any particular word related to above topics, you can just type the word and hit enter button and you will see the all the necessary data in a tabular format.

More...

Asp.Net - Bindable image upload web user control with image preview

 

Developing Image upload web user control with image preview in asp.net:

As a developer working for content management system/ecommerce/blogging/social sites development, one most frequent task is image upload.

We spend lots of time dragging/dropping file control, upload button and writing code to check for file extension and then uploading the image on the site in specified directory location.

And if one wants to show the preview this task gets even much lengthier.

Keeping this in mind I wrote a web user control which is generic in nature and can be just used on any page with little configuration and offcourse no code rewriting.

Also this user control is bindable and has image preview if choosen. So this can be used inside data grid view/form view/list view/repeater/details view/data list control by just dragigng and dropping.

So lets start building image upload web user control with preview (optional):

1. Add a web user control to your website project.More...

Scrum Cheatsheet - Quick pocket reference

Agile development is now widely accepted and there are more companies and people who have started following this development methodology.

The most wisely used agile process is "Scrum". In scrum work is divided into short cycles called "Sprint". Typically the sprint duration is 2-4 weeks but it can be as short as one week and as long as one month.

The whole scrum is composed of 3 roles, 3 activities and 3 artifacts.

Given below is a scrum cheat sheet which consists of all major terms and short definitions. This sheet can be used as quick refresher or pocket reference.More...

C# - Swapping values of two variables without using third variable

 

 

Lots of guys are asked and have delved into solving a very common question - How do you swap values of two variables without using third variable?

Well there are more than one ways, we could achieve it.

So first let's start from school days.

1. using 3rd variable:

 

class Program
    {
        static void Main(string[] args)
        {
            SwappingUsingThirdVariable();
        }

        private static void SwappingUsingThirdVariable()
        {
            int num1=7, num2=9, num3=0;
            Console.WriteLine("Before swapping: num1={0}, num2={1}", num1, num2);
            num3 = num1; num1 = num2; num2 = num3;
            Console.WriteLine("After swapping: num1={0}, num2={1}", num1, num2);
            Console.ReadLine();
        }
    }

 

 


2. Witout using third variable and with help of plus/minus (+,-) operator: 

 

private static void SwappingUsingPlusMinusOperator()
        {
            int num1 = 7, num2 = 9;
            Console.WriteLine("Before swapping: 

num1={0}, num2={1}", num1, num2);
            if (num1 > num2)
            {
                num1 = num1 + num2;
                num2 = num1 - num2;
                num1 = num1 - num2;
                
            }
            else
            {
                num2 = num2 + num1;
                num1 = num2 - num1;
                num2 = num2 - num1;
                
            }
            Console.WriteLine("After swapping: 

num1={0}, num2={1}", num1, num2);
            Console.ReadLine();
        }

 

 

3. Witout using third variable and with help of mulitply/divide(*,/) operator:More...

Free SQL Server 2008 R2 Book download

SQL Server 2008 R2 - Free Book from Microsoft

If you are a sql server developer and wanted to have some free ebook on sql server 2008.

Here is the link I found while looking for the same. There is a free ebook download available on microsoft site for "SQL Server 2008 R2" edition.

This online book is the primary documentation for SQL Server.
Books Online includes the following types of information:
Setup and upgrade instructions.

Information about new features and backward compatibility.

Conceptual descriptions of the technologies and features in SQL Server.

Procedural topics describing how to use the various features in SQL Server.

Tutorials that guide you through common tasks.

More...

Posts By Month