This is a migrated thread and some comments may be shown as answers.

Data elements not populating

1 Answer 31 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Love
Top achievements
Rank 1
Michael Love asked on 09 Oct 2009, 02:47 PM
Hi there.

I am new to Telerik Reporting and I have read some KB articles about using a stored procedure as my data source. I think I have it setup correctly because my _NeedDataSource method is getting called, but none of my data elements are getting populated. I am just hard-coding the parameters for now and when I run the sproc manually, I get data, so I am confused as to why I am not getting any data in my report. Here is my class:

 

public partial class My_Report : Telerik.Reporting.Report

 

{

  public My_Report()

  {

    InitializeComponent();

    this.DataSource = null;

 

    this.NeedDataSource += new System.EventHandler(this.My_Report_NeedDataSource);

  }

 

 

 

  private void My_Report_NeedDataSource(object sender, System.EventArgs e)

  {

    //Transfer the ReportParameter value to the parameter of the select command

 

    this.sqlDataAdapter1.SelectCommand.Parameters["@PersonID"].Value = 8;

 

    this.sqlDataAdapter1.SelectCommand.Parameters["@OperatorID"].Value = 11; 

 

    //Take the Telerik.Reporting.Processing.Report instance and set the adapter as it's DataSource

 

    Telerik.Reporting.Processing.

Report report = (Telerik.Reporting.Processing.Report)sender;

 

    report.DataSource =

this.sqlDataAdapter1;

 

  }

}

 

 

I have each of my fields in a table referencing in this manner:
    =Fields.TaskNumber

I do no receive any errors or anything, so I am looking for some guidance.

Thanks, Mike

 

More info:
When I added this to my NeedDataSource method:

 

 

this.sqlConnection1.Open();

 

 

int rows = this.sqlSelectCommand1.ExecuteNonQuery();

rows returns -1, so I am somehow not getting any data back. I removed the parameters from the sproc and just hardcoded them and I still get a return value of -1 in rows. Any ideas?

 

1 Answer, 1 is accepted

Sort by
0
Michael Love
Top achievements
Rank 1
answered on 09 Oct 2009, 05:02 PM
I read another post by Mark that stated that you also have to set the datasource of the table to the report datasource and this gave me my results back!

It is all working now.

Thanks, Mike
Tags
General Discussions
Asked by
Michael Love
Top achievements
Rank 1
Answers by
Michael Love
Top achievements
Rank 1
Share this question
or