Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How do I put the result of my stored procedure into a dataset in C#?

Avatar of Shepwedd
Shepwedd asked on
.NET ProgrammingASP.NET
10 Comments1 Solution380 ViewsLast Modified:
I have written the attached code but I'm not too sure how I can put the result of my stored procedure into my dataset which will then allow me to bind my ReportViewer control to the filled dataset...
ReportViewer1.Visible = true;
        SqlConnection thisConnection = new SqlConnection(thisConnectionString);
        System.Data.DataSet thisDataSet = new System.Data.DataSet();
        SearchValue[0] = new SqlParameter("@DueDate", DropDownList1.SelectedValue);
        SqlCommand cmd = new SqlCommand("proc_ShowCrucialByDate", thisConnection);
        cmd.CommandType = CommandType.StoredProcedure;
        thisDataSet = cmd......?
        ReportDataSource datasource = new ReportDataSource("CrucialDatesDataSet_proc_ShowCrucialByDate", thisDataSet.Tables[0]);
        if (thisDataSet.Tables[0].Rows.Count == 0)
            lblMessage.Text = "Sorry, no products under this category!";