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

Telerik Reporting Newbie

1 Answer 105 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 05 Jun 2009, 07:20 PM
Hi. I am currently experimenting (newbie) with Telerik reports in VS 2008. I have programmatically bound a SQLAdapter object to a datasource of a Telerik report. The next question becomes how do I display the data on the report now. Do I need to somehow programmatically tap into the datasource and create the detail fields.? When I go to preview the report in the Report Design of Visual Studio iget an error that says "Exception has been thrown by target of invocation. Object reference not set to an instance of an object" . The end goal here is to display this in a web report viewer on an .aspx page but I am pretty sure i need to get the report itself working first. Any direction one could provide would be greatly appreciated. Below is my code to bind the report datasource just as a reference. The report currently does infact build. Any help would be greatly appreciated.

--Jason

 

public Report1()

 

{

 

/// <summary>

 

 

/// Required for telerik Reporting designer support

 

 

/// </summary>

 

InitializeComponent();

 

 

SqlConnection connSomsys = new SqlConnection(ConfigurationManager.ConnectionStrings["connSomsys"].ConnectionString);

 

 

SqlCommand sqlSelectCommand1;

 

 

sqlSelectCommand1 =

new SqlCommand("sprocgetorders", connSomsys);

 

sqlSelectCommand1.CommandType =

CommandType.StoredProcedure;

 

 

SqlDataAdapter adap = new SqlDataAdapter(sqlSelectCommand1);

 

 

this.DataSource = adap;

 

 

//

 

 

// TODO: Add any constructor code after InitializeComponent call

 

 

//

 

}

1 Answer, 1 is accepted

Sort by
0
Hrisi
Telerik team
answered on 12 Jun 2009, 08:06 AM
Hi Jason,

To explain how to start using our Reporting we created a movie. The next explanation is based on this movie.
In order to design the report you need to retrieve the schema of the data returned by the stored procedure. The easiest way to get the schema is by creating the typed dataset (DataSet3). Next we use it as DataSource in the Report Wizard. The newly created report can be additionally customized using our Data Explorer. We add one report parameter to be used when calling the stored procedure. Do not forget to set UI.Visible=True, because this is not shown on our movie. Visual studio creates a table adapter that can be used to retrieve data and we do this in the NeedDataSource event handler. In order to raise this event, we set report.DataSource=null in the constructor.
 
Best wishes,
Hrisi
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Jason
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
Share this question
or