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();
please asma tell me.
ReplyDeletei have drag to stored proc on data set 1st name rb and 2nd name is finalbal and i drag all record from dataset to report.rdlc and i drag microsoft report viewer on form and back i wrote this code
DataSet2.rbDataTable data = new DataSet2.rbDataTable();
DataSet2TableAdapters.rbTableAdapter adt = new DataSet2TableAdapters.rbTableAdapter();
adt.Fill(data, 1);
ReportDataSource rds = new ReportDataSource("DataSet2_rb", data);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
if (TextBox1.Text == "")
{ TextBox1.Text = "0"; }
adt.Fill(data, Int32.Parse(TextBox1.Text));
but what i wrote for 2nd datatable(finalbal)
plz reply me at mfaisalrah@gmail.com
hi
ReplyDeleteCan you help me to get a job in the Gulf, Dubai, Saudi or what ever, cos am a developer with 3 years experience. (DOt Net). If its possible I would send you my resume :-)
hi asma that you are a great
ReplyDeleteJob.thank you
welcome
Delete