Quantcast
Channel: Visual Studio Report Controls Forum
Viewing all articles
Browse latest Browse all 519

show report data according to stored procedure and parameters

$
0
0

hi all I am trying to create a report which show me sold products between two dates

this is what I have done

but it is giving me this error

  • A data source instance has not been supplied for the data source 'ShowSelling'.

this is my code

{

                DataSet thisDataSet = new DataSet();
                SqlConnection thisConnection = new SqlConnection(thisConnectionString);
                SqlDataAdapter dataAdapter = new System.Data.SqlClient.SqlDataAdapter();

                System.Data.SqlClient.
                SqlCommand select = new System.Data.SqlClient.SqlCommand();

                select.CommandType = CommandType.StoredProcedure;

                select.Connection = thisConnection;
                select.CommandText = "ShowSelling";

                select.Parameters.Add(
                "@SDate", SqlDbType.DateTime).Value =Convert.ToDateTime( TextBox1.Text);

                select.Parameters.AddWithValue(
                "@EDate", SqlDbType.DateTime).Value = Convert.ToDateTime(TextBox2.Text);

                
                dataAdapter.SelectCommand = select;

                dataAdapter.Fill(thisDataSet);
 ReportDataSource datasource = new
                  ReportDataSource("ShowSellingDataSet_ShowSelling", thisDataSet.Tables[0]);

                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(datasource);

                if (thisDataSet.Tables[0].Rows.Count == 0)
                {
                    Label1.Text = "Sorry, no products under this category!";
                }

                ReportViewer1.LocalReport.Refresh();
            }

and this is the procedure

/////////////////////////////////////////////////////////////////////////////////////////////////

ALTER PROCEDURE  ShowSelling(@SDate DateTime , @EDate DateTime  )
AS
SELECT  neworder.Date, Software.SName,
        Software.Price, neworder.quantity
FROM    neworder INNER JOIN
                         Software ON neworder.softID = Software.softID
WHERE   neworder.Date between @SDate and  @EDate
RETURN

///////////////////////////////////////////////////////////////////////////////////////////

please help !!!!


Viewing all articles
Browse latest Browse all 519

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>