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

Parameter in a Query gives me Fatal Error

4 Answers 339 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Christel
Top achievements
Rank 1
Christel asked on 26 Feb 2009, 06:48 PM
I am new to Telerik Reporting.  I am using Visual Studio 2008 and Telerik Reporting Q3 2008 SP2.  We are using MySQL as the database backend.

I added a new report to a project and canceled out of the Wizard.  I went to the report and clicked on the drop down on DataSoruce and clicked on Add Project Data Source. I choose Database and clicked Next. I already had a connection setup so I choose that and clicked on Next. I pasted a query into the query window. When I clicked on Finsh I get this error:

An unexpected error has occurred.  Error Message: Fatal Error encountered during command execution.

What am I doing wrong? I had watched a video that showed you can use parameters in queries.   Here is the query code.


SELECT     i.incidentid, i.icr, i.committedDt, l.addressid, a.masteraddressid, trim(concat(trim(housenumber), ' ', trim(streetname), ', ', trim(city))) AS Address,
                      i.incidenttype, v.ReferenceType, n.NameID, n.Race, n.Gender, CONVERT(DATEDIFF(NOW(), N.DOB) / 365, signed) AS Age, ni.ReferenceTypeID
FROM         analytics_location l JOIN
                      analytics_address a ON a.addressid = l.addressid JOIN
                      analytics_incident i ON i.incidentid = l.incidentid LEFT JOIN
                      analytics_nameinvolvement ni ON ni.incidentid = i.incidentid LEFT JOIN
                      analytics_name n ON n.nameid = ni.nameid LEFT JOIN
                      v_Analytics_NameReferenceType v ON v.referencetypeid = ni.referencetypeid
WHERE     l.addressid = @AddressID OR a.masteraddressid = @AddressID


4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 27 Feb 2009, 09:37 AM
Hello Christel,

Indeed parameters in query would not be recognized by our datasource wizard and this is a known limitation. You can however remove the parameters from the query, finish the wizard, then edit the dataset, add the parameters to your query and save it.

Sincerely yours,
Steve
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.
0
Christel
Top achievements
Rank 1
answered on 27 Feb 2009, 01:35 PM
Hi Steve, 

I took out the where statement and finished the datasource wizard.  I'm getting an error when I build the solution now.  I'm not sure I added the parameter correctly  So this is where I am right now.  On the report design surface, there is a dsMasterAddress dataset.  I right clicked on that and choose Edit in Dataset Designer.  A dsMasterAddress.xsd file came up.  I clicked on the dsMasterAddressTableAdapter and in the properties window I see there is a Select Command that I can expand.  I clicked on the Parameters collection and click on the ellipse to bring up the parameters collection editor.  I clicked on Add and put AddressID in both the ColumnName field and SourceColumn and changed the dbtype to Int32.  I named it @AddressID.   I added another parameter, called @MasterAddressID and put MasterAddressID in both the ColumnName and SourceColumn name and changed the dbtype to Int32. When I click on OK, I try to build the solution and I get 'No overload for method 'Fill' takes '1' arguments'.  What did I do wrong?
Also, how will it know to do an Or on those parameters?

Thanks for all the help so far!
Christel
0
Christel
Top achievements
Rank 1
answered on 27 Feb 2009, 03:03 PM
Hi Steve,

Instead of just adding a parameter, in the table adapter select command, I changed the select statement and added my where clause and added the parameters there, with my OR statement.  I had deleted the parameters out before I did that.  It created the parameter but I still get the same error, that no overload for method 'Fill' takes '1' argument.

Thanks
Christel
0
Accepted
Milen | Product Manager @DX
Telerik team
answered on 02 Mar 2009, 09:49 AM
Hello Christel,

The Report wizard generates typed DataSet with DataAdapter that you will use in you report to get data. Also it generates instances of both classes inside your report and code located in the report's constructor that fills the dataset using the adapter. So there you will find a call to the Fill method of the adapter, but since you have changed the adapter (adding parameters) you need to update that Fill call by passing additional arguments as values of the SQL paramaters.

Please review the chapter Connecting Data to a Report in our help to fully understand how to provide data to your reports. Keep in mind that the reporting engine can consume many different data sources, but it is up to the developer to fill the datasource and provide it to the report (using the DataSource property).

If you need to allow the end users to choose the values of the SQL parameters, you will find helpful our ReportParameters - they can generate automatic UI prompting for input from the end user. This KB demonstrates how to do tis.

Hope this information helps.

Sincerely yours,
Milen
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
Christel
Top achievements
Rank 1
Answers by
Steve
Telerik team
Christel
Top achievements
Rank 1
Milen | Product Manager @DX
Telerik team
Share this question
or