Showing posts from May, 2011

Delete with Dapper ORM and ASP.NET MVC 3

I have been writing few posts about Dapper ORM and ASP.NET MVC3 for data manipulation. In this post I am going to explain how we can delete the data with Dapper ORM. For your reference following are the links my previous posts.

Playing with dapper Micro ORM and ASP.NET MVC 3.0
Insert with Dapper Micro ORM and ASP.NET MVC 3
Edit/Update with dapper ORM and ASP.NET MVC 3

So to delete customer we need to have delete method in Our CustomerDB class so I have delete method into the CustomerDB class like following.

public bool Delete(int customerId) { try { using (System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(Connectionstring)) { sqlConnection.Open(); string sqlQuery = "DELETE FROM [dbo].[Customer] WHERE CustomerId=@CustomerId"; sqlConnection.Execute(sqlQuery, new {customerId}); sqlConnection.Close(); } return true; } catch (Exception exception) { return false; } }Now our delete method is …

Edit/Update with dapper ORM and ASP.NET MVC 3

In last two post I have already written about Getting data and adding data with Dapper Micro ORM. In this post I will explain how we can use the dapper ORM for data update. For reference following is the two post links for the Dapper ORM Series.
Playing with dapper Micro ORM and ASP.NET MVC 3.0Insert with Dapper Micro ORM and ASP.NET MVC 3Now as you we have already created CustomerDB Class. In this database operation class we will add two more methods GetCustomerById and Update to get Customer based on CustomerId passed and another one is for updating data. Following is modified Customer DB Code.
public class CustomerDB { public string Connectionstring = @"Data Source=DotNetJalps\SQLExpress;Initial Catalog=CodeBase;Integrated Security=True"; public IEnumerable<Customer> GetCustomers() { using (System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(Connectionstring)) { sqlConnection.Open(); var cu…

Insert with Dapper Micro ORM and ASP.NET MVC 3

As I have already posted about the how to fetch data in my earlier post for Dapper ORM. In this post I am going to explain how we can insert data with the dapper ORM. So let’s extend the earlier post project. As explained in earlier post I have already created a class called CustomerDB this class will contains all the operation with Dapper Micro ORM. So For inserting data let’s first create CREATE method like following in CutomerDB Class like following. In that I have create a simple Insert Query in string and then using connection.execute method to execute method. Following is code for that.
public class CustomerDB { public string Connectionstring = @"Data Source=DotNetJalps\SQLExpress;Initial Catalog=CodeBase;Integrated Security=True"; public IEnumerable<Customer> GetCustomers() { using (System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(Connectionstring)) { sqlConnection.Open(); var cust…

Microsoft Community Techdays at Ahmedabad-11th June 2011

Microsoft community TechDays are great events organized by Microsoft and every time I like to be part of it. Now once again this event date is announced  by Microsoft and its going to happen 11th June 2011. I would love to part of it. It’s a free event so you don’t need to pay for it.  It’s a good chance to do some social networking with Microsoft MVPS and professionals like Jacob Sebastian, Pinal Dave, Harish Vaidyanathan. You will also learn lots of new things.

Following is agenda for this event.


09:30am - 10:00am

10:00am - 10:15am
Welcome Note

LightSwitch On The Cloud! by Mahesh Dhola
10:15am to 11:15pm
The session would give introduction to Visual Studio Light Switch followed by the demo. The demo would give insight of developing Light Switch application and deploying to the Microsoft cloud offerings Windows Azure.

SQL Server Performance Troubleshooting using Waits and Queues by Pinal Dave
11:15am to 12:15pm
Just like a horoscope, SQL Server Waits and Queues can…

Playing with dapper Micro ORM and ASP.NET MVC 3.0

Some time ago Sam Saffron a lead developer from has made dapper micro ORM open source. This micro orm is specially developed for for keeping performance in mind. It’s very good single file which contains some cool functions which you can directly use in your browser. So I have decided to have a look into it. You can download dapper code from the following location it’s a single static class file called SQLMapper.

So once you download that file you can use that file into your project. So I have decided to create a sample application with mvc3. So I have created a simple mvc 3 project called DapperMVC. Now let’s first add that SQLMapper class file into our project at Model Folder like following.

Now let’s first create sample table from which we will fetch the data with the help of dapper file. I have created sample customer table with following script.


Nav tag in HTML5

HTML5 is great new version of HTML with great features. I am exploring that in great details for our forthcoming projects. I found a great tag that can be used in all websites for the navigation. <nav> tag defines a area for navigation in whole HTML markup.

The HTML5 specification for nav tag is like following. You can find all the HTML 5 specification here.
The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links. Not all groups of links on a page need to be in a nav element only sections that consist of major navigation blocks are appropriate for the nav element. In particular, it is common for footers to have a list of links to various key parts of a site, but the footer element is more appropriate in such cases, and no nav element is necessary for those links. <nav> tags can be used as navigation area and under it you can put the group of links that will use for navigation of area. For exampl…

HTML5 Intellisense in Visual Studio 2010/2008

Recently I was playing with HTML5 and I was in need of the HTML5 intellisense in Visual Studio 2010. I found a great extension which will provide me a great intellisense for HTML5. I thought its great to share with you all.  You can download that tool from following link.

Once you download install it. You need to change your validation to HTML5 in your Visual Studio 2010 configuration. For that you have to go to Tools->Options->Text Editor->HTML->Validation and there you need to select the HTML5 like following.

That’s it now your visual studio 2010 or 2008 will have intellisense for HTM5. Just like following.

That’s it. Hope you like it. Stay tuned for more..Happy programming.

What’s new in SQL Server ‘Denali’ Management Studio.

Before sometime Microsoft has launched SQL Server Denali CTP a new version of SQL Server. I have downloaded it and install it on my machine. I have found variety of new features in SQL Server. Today I am going to explore some of the new features in SQL Server Denali Management Studio. Following are some of the new features of SQL Server Denali Management Studio.
New Font and New Colour Scheme:First thing you notice when you start SQL Server Management Studio is the colour scheme it has nice blue theme just like Visual Studio 2010. Also if you see that now the default font is ‘Consolas’. Just like following.

Multi monitor Support:Now SQL Server management Studio also can be work in multi monitor also. You can drag each window and set it for another monitor.Now you can each window can appeared out of shell of SSMS and You can drag with each window in different monitor like following.

Code Snippets:Now there are lots of code snippets are available and you can that code snippets via right…

Task list window in Visual Studio 2010

Task list is a great feature of visual studio and I think its most unappreciated features of Visual Studio 2010 and most of developers are not aware of it or don’t know about it and that’s why they are not using it. So I decided to write blog post about it.

As .NET Developer we spend lots of time writing code with Microsoft Visual Studio and sometimes we need to write comments for future reference like for debugging we need to some code undone or we need to write some code in future at that time this Task List feature of Microsoft Visual Studio comes very handy .

Let’s first see how we can configure Task List Window in Visual Studio to help us better in coding. You can configure Task List window options via Tools-> options then go to Environment and then click Task list then a window will appear like following.

Here you can see the Standard Token of Visual Studio Also you can add your own Tokens also..You can see task list window via View-> Task List window like following. …

What’s new in Internet Explorer 9?

Microsoft has recently launched the Microsoft Internet Explorer 9 and I have just installed it on it in my machine and I am quite amazed with the features its providing so I thought its worth to right a blog post about it.

The first and foremost thing you will notice about IE9 is a new slick interface. It has very nice user interface with address bar and tab are both on the same line. You can also enable old view like IE via right click->Show tabs on a separate Row. Like following.

You can change tab via like following.

and You can achieve same look like IE8 like following.

Additionally clicking on the new tab it will present you a layout where you can see the most visited sites with the popular list popular stuff.

Another use full feature will search enhancement where you can directly find the things with Bing search engine in your address bar just like below.

You can turn off search suggestions via clicking on Turn off Suggestions. Also you can pin sites in IE9 just like you can…