GridView Fill Dataset with StoredProcedure ASP.NET C#
===========================================================
DataSet MyQueryMethod(string sqlQueryString)
{
DataSet ds = new DataSet();System.Data.SqlClient.
SqlConnection sqlConnection = new System.Data.SqlClient. SqlConnection(System.System.Data.SqlClient.
SqlDataAdapter dataAdapter = new System.Data.SqlClient. SqlDataAdapter();System.Data.SqlClient.
SqlCommand select = new System.Data.SqlClient. SqlCommand(sqlQueryString);select.CommandType =
CommandType.StoredProcedure;select.Connection = sqlConnection;
select.Parameters.Add(
"@startdate", SqlDbType.DateTime).Value = TextBox1.Text;select.Parameters.
dataAdapter.SelectCommand = select;
dataAdapter.Fill(ds);
return ds;}
===========================================
on Load event for call the function
GridView1.DataSource = MyQueryMethod("BrowseUserCharge");
GridView1.DataBind();