11/21/2012

cannot be opened because its project type (.csproj) is not supported by this version of the application.

Go to Start> All Programs > Visual Studio 2008 > Visual Studio Tools > Click Visual Studio 2008 Command Prompt. Type the below command and press enter.

devenv.exe /resetskippkgs

8/27/2012

SQL Delete current database

I need to delete my current database which I am using it , I googled around and found this answer:

http://sqlserver2000.databases.aspfaq.com/how-do-i-drop-a-sql-server-database.html

ALTER DATABASE myDataBase
    SET SINGLE_USER
    WITH ROLLBACK IMMEDIATE

DELETE DATABASE myDataBase 

8/16/2012

C# difference between StringBuilder and String Object

The most common operation with string is concatenation, and this has to be performed very efficiently.
When we use String objects to concatenate two strings , then a new copy of string object is created in memory by adding two objects , and the old string object is deleted.

So we use StringBuilder to do it in a effective way, here the concatenation is done on the exsisting  string, hence the insertion is faster. Concatenation is done using Append() method

8/02/2012

C# Shallow Copy and Deep Copy

Difference between null and String.Empty

1. string statement=null : means no object exists; null is not a value, it is a state indicating that object value is unknown or does not exists.

2. string statement = String.Empty : use of string.Empty doesn't create any objects  while "" creates a string object. So using string.Empty is better than using "" because every time you use "", it creates a new string while string.Empty just reference s string in memory that is created by default.

8/01/2012

Understanding Reflection and static constructor

Hi .net newbies,
This post is mostly for you !!, to understand what  Reflection and static constructor really mean ,and when are they used in  .net projects.

You would have learnt what does .net reflection and static constructor mean , 
You may say reflection is :  The process of obtaining information about the assemblies and the types defined within them ,and creating and invoking and accessing type instance at run time and
You may say static constructor is used to initialize any static data or to perform a certain action that needs to be performed once.

So when do you use Reflection or static constructor, the below picture answers the question:


7/23/2012

WCF as Windows Services Step by Step example

Hi Guys, in this post I will be explaining how to create a simple WCF service and host it as a 'Windows Service'.

Lets create a simple Windows Service which has a OperationContract which will add numbers and return it

Step 1: Create a simple WCF service library
Step 2: Create a simple Windows Services in which you will host the service
Step 3: Install the Windows Service
Step 4: Consume the Windows Services in a Windows Form Client.

Step 1: Create simple WCF Service library:

1. Open Visual Studio 2010 , Create new project and choose Windows Service Library named as Wcf_WindowsService_Add


2. Delete these files: App.config, IService1.cs, Service1.cs, and create your own WCF Service, Right click your project and create new item - > WCF Service name it as WindowsServiceAdd.cs

                             

3. In app.config files you can see two endpoints with bindings wsHttpBinding and mexHttpBinding and with abase address

4. Open  IWindowsServiceAdd.cs  Interface remove Dowork() Contract and your Contract with name Add()





5.  Open  WindowsServiceAdd.cs  remove DoWork() and define your Add() OperationContract :




6. Build your project , now your WCF Service library dll is ready to use.


Step 2: Create a simple Windows Services in which you will host the service:




1. Right Click your solution and create new project. -> Windows -> Windows Services.

                              

2. Delete Program.cs and Service1.cs and create your own Service , by right clicking the project add new item -> Windows Service

                          

3. Click 'click here to switch to code view' , and modify the code as shown below to add a Service Host and methods to stop and start the services ,and add System.ServiceModel to your project , and your Service Library dll too


4. Add Program.cs file



5.Build this project . now it is ready to be installed in your machine



Step 3: Install the Windows Service 


1. Inorder to install the service we need Installer class, so add new installer class:





2.Goto Start - > All programs -> Visual Studio 2010 - > Visual Studio Tools -> Visual Studio command prompt. Goto to  path of your serviceAdd.exe ,  and install it using ' installutil serviceAdd.exe




3. You can see your service in Service Console









Step 4: Consume the Windows Services in a Windows Form Client.


1. Start your service , Create a new Windows Form project, refer your WCF hosted as Windows services ( http://localhost:8732/Design_Time_Addresses/Wcf_WindowsService_Add/WindowsServiceAdd/ ) to this project. add a  lable and a button, double click the button and and add the bellow code , and run your project :






2. Build and Run your Windows Form to consume the service








6/19/2012

SQL Constraints

Constraints limit the type of  data that can go into the table.
The following are the constraints:
  1. NOT NULL
  2. UNIQUE
  3. PRIMARY KEY
  4. FOREIGN KEY
  5. CHECK
  6. DEFAULT

6/18/2012

SQL Joins

Hi newbies,
Want to learn SQL joins at a glance!!, here you go... SQL joins is Venn diagram representation:
A very nice picture given in codeproject.

http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins


5/13/2012

What are EXD files

EXD is control information cache file . It is a type of file that contains your most recently used information of a computer object , which in this case is a control

read more

1/11/2012

How to turn on Telnet client on your machine?

Here are the steps by which you can turn on the telnet client:
Goto Control panel ->     Programs and features ->      Turn Windows feature ON or OFF ->                                            Check Telnet Client ->     OK

HTTP Protocol

Nice tutorial on HTTP protocol:

Read here..