21 April, 2012

Create, Drop, Insert, Update, Delete and Select – The Basic SQL


This topic for those who are very beginner of SQL. Here I will show some basic SQL by Microsoft SQL Server.

1.       Create a table: Here I created a table name hrm_employee. Here emp_gid is int type, primary key and identity. Identity means its value will increment automatically by the sql server. You don’t need to insert it’s value.

--Create Table : hrm_employee---
CREATE TABLE hrm_employee
(
      emp_gid INT PRIMARY KEY IDENTITY,
      emp_fullnm VARCHAR(100),
      emp_nicknm VARCHAR(50),
      emp_designation VARCHAR(100)
)


2.       Insert data in hrm_employee table: In this occasion, I have inserted 3 data i.e 3 rows. If you see in closer look, you will see that I didn’t insert any value of emp_gid because it increments its value automatically because it is an identity column.

---Insert data ito table: hrm_employee----

-- Insert data i.e. row-1 ---
INSERT INTO hrm_employee
(
      emp_fullnm
      , emp_nicknm
      , emp_designation
)
VALUES
(
      'Md. Mahedee Hasan'
      , 'Mahedee'
      , 'Senior Software Engineer'
)    

-- Insert data i.e. row-2 ---
INSERT INTO hrm_employee
(
      emp_fullnm
      , emp_nicknm
      , emp_designation
)
VALUES
(
      'Md. Asrafuzzaman'
      , 'Emon'
      , 'Senior Software Engineer'
)    


-- Insert data i.e. row-3 ---
INSERT INTO hrm_employee
(
      emp_fullnm
      , emp_nicknm
      , emp_designation
)
VALUES
(
      'Md. Khondakar Enamul Haque'
      , 'Rony'
      , 'Broadcast Engineer'
)    


4. Infromation Retrive: Get all information of hrm_employee. Here I showed two ways to retrive data and I suggest to use second one. Second one is best practiced.

--Get all data from hrm_employee--
SELECT * FROM hrm_employee
--or
SELECT emp_gid, emp_fullnm, emp_nicknm, emp_designation FROM hrm_employee


5.  Update hrm_employee: Is very easy to update a row or multiple rows against a condition. Lets look on the following query.

--update data from table: hrm_employee --
UPDATE hrm_employee
SET emp_fullnm = 'M.K. Enamul Haque'
, emp_designation = 'Senior Broadcast Engineer'
WHERE emp_gid = 3

6. Delete Information: If you want to delete information from hrm_employee against a condition follow the query.

---Delete data from table: hrm_employee---
DELETE FROM hrm_employee WHERE emp_gid = 3

7. Drop Table: Drop table means remove table for database. Use the query to drop hrm_employee table.

---Drop table i.e remove table from Database--
DROP TABLE hrm_employee

16 April, 2012

First program using visual studio 2010


Hopefully you have already installed visual studio 2010. If you didn’t install yet, Install Visual Studio 2010 Step by Step.

So, let’s try to write our first program in visual studio 2010.

Step 1: Click Start -> Program -> Microsoft Visual Studio 2010 -> Microsoft Visual Studio 2010.










Step 2: If you open Visual Studio 2010 first time after installation in your computer. You will see the following screen. Select Visual C# Development Settings and click Start Visual Studio. We have selected Visual C# Development Settings because we will work with C#.



































Step 3: After Clicking Start Visual Studio at previous steps you will see the following screen. Click File -> New -> Project..










Step 4: Select Console Application among the projects. Note that I have changed my project location and Project name. You can keep default location and name.


Step 5:  Now you will see the following screen where you will develop your first program. You will see default code snippet which comes automatically.



Default code snippet:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyFirstProgram
{
    class Program
    {
        static void Main(string[] args)
        {
           
        }
    }
}


Add a simple statement in the Main Method:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyFirstProgram
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("This is my first program in C#");
        }
    }
}




Step 6: Click Debug -> Start Without Debugging or Press – Ctrl+F5. You will see the following screen.


Yes! You have done! This is your first program in C#. Happy programming!!!

15 April, 2012

Install Visual Studio 2010 Step by Step


Visual studio 2010 has eight major versions.
1.       Ultimate
2.       Premium
3.       Professional
4.       Express
5.       Team Foundation
6.       Test Professional
7.       Team Explorer Every Where
8.       Light Switch

The clear picture of Visual Studio 2010 is given below.












Prerequisite to install visual studio 2010

1.       Disable anti-virus or anti-spyware software
2.       Close all of your running software
3.       If you are using windows xp make sure it is service pack 3
4.       If you install other than windows xp make sure it is service pack 2 or more
5.       1 GB RAM
6.       3 GB of Hard disk space


Step by Step installation

Let’s start to install visual studio 2010. Here I will install visual studio 2010 Ultimate Edition. You can install it from hard disk or DVD ROM. If you install it from DVD ROM, visual studio 2010 will run automatically. I am installing it from my hard disk.

Step 1: Double click on setup.exe















Step 2: After clicking setup.exe file, you will see the following screen. Click Install Microsoft Visual Studio 2010

























Step 3: Click next to start installation.

























Step 4: After clicking next you will see the following screen.























Step 5: Select radio button I accept the license term
























Step 6: Select the features that you want to install and the path you want to install visual studio 2010. If you don’t select path it will install in default location. You can select either Full or Custom features. If you select custom you have to select features which you want to install. For the beginner I suggest to select full feature.

























Step 7: Then the setup will start to install its components.




































Step 8: Reboot your computer. To complete installation you may have to reboot your computer for one or twice.
























Step 9: After the rebooting, the setup will start again












Step 10: The setup starts to install the rest of the components.























Step 11: The installation complete.

























If you see the above screen, your installation completes. So, let cheers!!!