i want gridview binding using StoredProcedure.
here is my sp:
ALTER Procedure [dbo].[MySP]
AS
SELECT ...
...
...
...
FROM MyTable WHERE userid = '!!!'
and cs:
string ID = (string)Session["UserIdSession"]; SqlCommand command = new SqlCommand();
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds = new DataSet();
int i = 0;
string sql = null;
string connetionString = "...";
SqlConnection connection = new SqlConnection(connetionString);
connection.Open();
command.Connection = connection;
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "MySP";
adapter = new SqlDataAdapter(command);
adapter.Fill(ds);
connection.Close();
GridView.DataSource = ...
Go to the complete details ...