Posts

Showing posts from 2015

Insert Unique Value in MS SQL Database By Using SQL Stored Procedure

Image
When we enter some data in database then its repetition is major problem for at all. Here I am using a table with Mobile No. as primary key and trying to insert unique value to it. You can see database in this image.   Stored procedure wants phone no as a parameter which can be passed easily create procedure insert_unique ( @phone numeric(10,0) ) as begin INSERT INTO PhoneData(Phoneno)     SELECT @phone WHERE NOT EXISTS ( SELECT phoneno FROM PhoneData WHERE Phoneno = @phone) end Pass your phone no in this procedure and it will insert only unique record.

Interview Questions on .Net Part: 1

Image
Abstraction Abstraction means displaying or allows access to that part of program or class which is important. Take an example. How to achieve that? Take the below example in which I am declaring four string and out of them only one is public and rest are private or protected. When we create object of this class and try to access all these variables then we get permission to access only public variable. class AbstractionWaliClass     {         private string my_id;         private string my_name;         public string my_contact_no;         protected string protected_id;     }     Abstract Class: If you want to create a class that is only base class. No one can make instance of it. Then you should use Abstract class with the help of keyword ‘abstract’. abstract class AbstractClass     {     } Now what inside this class? Any method doesn’t necessary it should be abstract method bu