Posts

Showing posts from June, 2013

OOPS Concept with Real-world example

Introduction OOP is Nothing but Object Oriented Programming.According to Wikipedia,  Object-oriented programming (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs. OOPs have following features 1.  Object    - Instance of class 2.  Class     - Blue print of Object 3.  encapsulation   - Protecting our data 4.  polymorphism    - Different behaviors at diff. instances 5.  abstraction     - Hidding our irrelavance data 6.  inheritence     - one property of object is aquring to another property of object 1. Object Basically an object is anything that is identifiable as an single material item. You can see around and find many objects like Camera, Monitor, Laptop etc. In OOP perspective, an object is nothing but an instance of a class that contains real values instead of variables 2. Class A class is a template definit...

7 Simple Steps to Connect SQL Server using WCF from SilverLight

Image
Introduction and Goal In this article, we will look at how we can do database operations using Silverlight. We will first try to understand why we cannot call ADO.NET directly from a Silverlight application and then we will browse through 7 steps which we need to follow to do database operation from Silverlight. I have collected around 400 FAQ questions and answers in WCF, WPF, WWF, SharePoint, design patterns, UML, etc. Feel free to download these FAQ PDFs from  my site . Silverlight does not have ADO.NET Below are the different ingredients which constitute Silverlight plugin. One of the important points to be noted is that it does not consist of ADO.NET. In other words, you cannot directly call ADO.NET code from a Silverlight application. Now the other point to be noted is that it has the WCF component. In other words, you can call a WCF service. In other words, you can create a WCF service which does database operations and Silverlight application will make calls to...

Introduction to Locking in SQL Server

Image
Locking is a major part of every RDBMS and is important to know about. It is a database functionality which without a multi-user environment could not work. The main problem of locking is that in an essence it's a logical and not physical problem. This means that no amount of hardware will help you in the end. Yes you might cut execution times but this is only a virtual fix. In a heavy multi-user environment any logical problems will appear sooner or later. Lock modes All examples are run under the default READ COMMITED isolation level. Taken locks differ between isolation levels, however these examples are just to demonstrate the lock mode with an example. Here's a little explanation of the three columns from sys.dm_tran_locks used in the examples: resource_type This tells us what resource in the database the locks are being taken on. It can be one of these values: DATABASE, FILE, OBJECT, PAGE, KEY, EXTENT, RID, APPLICATION, METADATA, HOBT, ALLOCATION_UNIT. reque...

Using SQL Server 2012 T-SQL New Features

Image
Introduction SQL Server 2012 “Denali” is the next major release of Microsoft database server. There are some new features that are added to T-SQL to make common tasks much easier. I will show how to use some of the new features in this article. Sequence Generating a sequence number, a.k.a. auto number, is a common task in an enterprise application. For a single table, you can specify identity field. But, if you want to have database wide sequential number, then you must devise something by yourself before SQL Server 2012. One solution to this problem is to create a table that has a numeric field can be used to store sequential number, then use SQL to increase it every time used one. In SQL Server 2012, we have a new solution - use Sequence. Create Sequence To create a Sequence in SQL Server 2012 is very simple. You can create it with SQL Server Management Studio or T-SQL. Create Sequence with SQL Server Management Studio In Object Explorer window of SQL Server Manageme...