Steps to connect with Database…

Step 1. Create a connection string.
SqlConnection SqlCon=new SqlConnecyion(“Connectionstring”);

Step 2. Open the connection.

SqlCon.Open();

Step 3. Pass a query through command object

SqlCommand SqlCom;

SqlCom=SqlCon.CreateCommand;

SqlCom.CommandText=”sqlQuries” ;

Step 4. Read the using datareader.

SqlDatareader dr= SqlCom.ExcuteReader();
Step 5. Display the data using any display control.

Like DataGrid or GridView or DropDownBox Datalist etc

Step 6. Close the connection
SqlCon.Close()

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: