Monday, April 12, 2010

Showing how to create a sql connection by code...

Step 1 : Add Namspace "using System.Data.SqlClient;"

Step 2 : Make Sql connection.

Write this code to create Sql connection.
SqlConnection con = new SqlConnection("Server=You server name or comp name;Database=Yourdatabasename;Trusted_Connectopn=True");
SqlCommand cmd = new SqlCommand("Write your sql query here eg. select * from Table name");
DataSet ds = new DataSet(cmd,con);
SqlDataAdapter da = new SqlDataAdapter();

Action Method in Mvc

In this section, you will learn about the action method of controller class. All the public methods of a Controller class are called Act...