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

SelectCommand error

1 Answer 31 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steve Healey
Top achievements
Rank 1
Steve Healey asked on 27 Aug 2009, 07:05 PM
Hi,

I seem to be getting a random error when viewing a report. The error is:

An error has occured while processing Report:
The SelectCommand property had not been initialized before calling 'Fill'

I have looked through the help files and this forum but as yet no luck, anyone have any ideas?

Many thanks.

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 28 Aug 2009, 03:52 PM
Hello Steve,

This is a generic .NET error and is not directly related to our product. Most likely it comes from your code responsible for preparing the data and feeding it to the report, which is up to the developer. Here is a sample working snippet:

 string sql =
   @"SELECT Production.Product.Name, Production.Product.ProductNumber FROM Production.Product";
 string connectionString =
   "Data Source=(local)\\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True";
 SqlDataAdapter adapter = new SqlDataAdapter(sql, connectionString);
 DataSet dataSet = new DataSet();
 adapter.Fill(dataSet);
 this.DataSource = dataSet;

This code can be placed in the report constructor. If you use NeedDataSource event for binding, you need to use the processing report object - Adding a Data Source through NeedDataSource report event.

All the best,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Steve Healey
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or