DOT NET – What is a cookie

Recently I got a message from one of the reader of my site that what exactly is a cookie. So I decided to wire a post dedicated to it .

  1. A cookie is name=value pair like variable which is stored as a file(persistant cookie) and which travels automatically between every request and response.
  2. Cookies are based on domains(website). As long as user is working with current web site cookie will be available.
  3. Cookies are maintained by browser but not by server which means cookies based websites are dependent on client.
  4. Cookies can be created as
    (i) In-memory cookie
    (ii) Persistant Cookie

An In-memory cookie means as long as user is working with app it will be available – also called as Session Cookie.

Persistant cookie means it will be stored in client physical location and available online as well as offline.

Reference : Dilip Kumar Jena ( )


DOT NET 3.0 – Features of C# 3.0

C# 3.0 is the current version, and was released on 19 November 2007 as part of .NET Framework 3.5. It includes new features inspired by functional programming languages such as Haskell and ML, and is driven largely by the introduction of the Language Integrated Query (LINQ) pattern to the Common Language Runtime.[9]

C# 3.0 was unveiled at the 2005 Professional Developers Conference. It is not currently standardized by any standards organisation, though it is expected that it will eventually become an ECMA and then ISO standard, as did its predecessors.

Reference : Dilip Kumar Jena ( )

DOT NET 4.0 – Versions and Features


1.0, 1.5, 2.0 (ECMA), 3.0


C# differs from C and C++ in many ways, including:

  • There are no global variables or functions. All methods and members must be declared within classes. It is possible, however, to use static methods/variables within public classes instead of global variables/functions.
  • Multiple inheritance is not supported, although a class can implement any number of interfaces. This was a design decision by the language’s lead architect to avoid complication.
  • Full type reflection and discovery is available.

Reference : Dilip Kumar Jena ( )

DOT NET 4.0 – Design goals for C#.NET

The ECMA standard lists these design goals for C#:

  • C# is intended to be a simple, modern, general-purpose, object-oriented programming language.
  • Because software robustness, durability and programmer productivity are important, the language should include strong type checking, array bounds checking, detection of attempts to use uninitialized variables, source code portability, and automatic garbage collection.
  • The language is intended for use in developing software components that can take advantage of distributed environments.
  • Programmer portability is very important, especially for those programmers already familiar with C and C++.
  • Support for internationalization is very important.
  • C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions.

Reference : Dilip Kumar Jena ( )

C Sharp (programming language) and History

C# is an object-oriented programming language developed by Microsoft as part of the .NET initiative and later approved as a standard by ECMA and ISO . Anders Hejlsberg leads development of the C# language, which has a procedural, object-oriented syntax based on C++ and includes influences from aspects of several other programming languages (most notably Delphi and Java) with a particular emphasis on simplification.


During the development of .NET, the class libraries were originally written in a language called Simple Managed C (SMC). In January 1999, Anders Hejlsberg formed a team to build a new language at the time called Cool. By the time the .NET project was publicly announced at the July 2000 Professional Developers Conference (PDC), the language had been renamed C# and the class libraries and ASP.NET runtime had been ported to C#.

C#’s principal designer and lead architect at Microsoft is Anders Hejlsberg, who was previously involved with the design of Visual J++, Borland Delphi, and Turbo Pascal. In interviews and technical papers he has stated that flaws in most major programming languages (e.g. C++, Java, Delphi, and Smalltalk) drove the fundamentals of the Common Language Runtime (CLR), which, in turn, drove the design of the C# programming language itself.

Reference : Dilip Kumar Jena ( )

Dot Net – How to upload excel sheet into databse using Dataset in ASP.NET

I thought of writing this blog post because there can a number of occasion where in you might need to upload something from word file or excel sheet or it can be any kind of  file need to be inserted into the database what we can do many things.

But probably what I feel good and follow most of the time is doing this way so that we can preserve the statements for future reference what we have actually used and where it is going to exactly affect.

Step 1: Create  a website and then add default page on to it.

Step 2: Write the following code in Page_Load(object sender, EventArgs e) function

DataSet ds = new DataSet();

OleDbConnection myCon = new OleDbConnection(@”Provider=Microsoft.Jet.OLEDB.4.0;Data Source=folderpath\sheet.xls;Extended Properties=Excel 8.0;”);

OleDbCommand myComm = new OleDbCommand(“select * from [sheet1$] where State<>””, myCon);

OleDbDataAdapter da = new OleDbDataAdapter(myComm);


for (int i = 0; i < ds.Tables[0].Rows.Count;i++ )


Response.Write(“insert into dbo.Temp2 values(‘” + ds.Tables[0].Rows[i][0].ToString() + “‘,'” + ds.Tables[0].Rows[i][1].ToString() + “‘,'” + ds.Tables[0].Rows[i][2].ToString() + “‘,'” + ds.Tables[0].Rows[i][3].ToString() + “‘)<br />”);



Step 3: Create a table in SQL Server names Temp2 where in u want insert the excel sheet into.

NOTE: The table name can be any name  you like its just an example never take it as standard, its for learing.

create table Temp2(Id varchar(10),country varchar(100),natAnimal varchar(50),lang varchar(50))

Step 4: Create or if u have  excel sheet just make sure that that contains header for each column it will be easy to understand


State Country Animal Language
1 Australia Kangroo English
2 India Peacock Hindi
3 USA American Biston English

This is a sample excel sheet name it as sheet and inside as Sheet1 it will be applied by default so just hit the save button.

So all set!!!

now save the excel sheet in the folder of your website and run the web site the expected Output will be something like this will appear in your broswer

insert into dbo.Temp2 values(‘1′,’Australia’,’Kangroo’,’English’)

insert into dbo.Temp2 values(‘2′,’India’,’Peacock ‘,’Hindi’)

insert into dbo.Temp2 values(‘3′,’USA’,’American Biston’,’English’)

then copy it and paste in ssms (SQL server Query Editor and hit F5 to execute) Finally records are inserted into the database.

There can be many more ways I am sure but this is also handy when you have production and development section seperate.

Reference : Dilip Kumar Jena ( )