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

Error with Guid parameter in report

6 Answers 554 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stanislav Dudnyk
Top achievements
Rank 1
Stanislav Dudnyk asked on 19 Jul 2010, 03:14 PM
I have two input parameters type of Guid.
I set default values for parameters like d6a0d1a8-0d5d-4850-9930-5670dfa26403 or 'd6a0d1a8-0d5d-4850-9930-5670dfa26403'

When report preview I have error : Failed to convert parameter value from a string to Guid.

What is wrong?

6 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 20 Jul 2010, 06:29 AM
Hello Stanislav Dudnyk,

Unfortunately our Report Parameters don't support GUID value types. Our suggestion would be to use a string parameter and with a Convert() function to change the parameter type to uniqueidentifier.

I have attached a sample report that shows how to accomplish your task. To run the sample project you will need the AdventureWorks database that comes with Telerik Reporting installation.

The SqlDataSource2 is using a Select statement as the one shown in the following code snippet:
 
Select Name From Production.Product WHERE rowguid=(SELECT Convert(uniqueidentifier,@RowGuid))
 
For more information check out Adding Parameters to Report help article.

Best wishes,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stanislav Dudnyk
Top achievements
Rank 1
answered on 20 Jul 2010, 06:36 AM
Thanks!
0
Stanislav Dudnyk
Top achievements
Rank 1
answered on 21 Jul 2010, 11:33 AM
What about stored procedure with uniqueidentifier parameter and I can't use text command or other stored?
0
Peter
Telerik team
answered on 22 Jul 2010, 04:23 PM
Hi Stanislav Dudnyk,

You can use the same approach in Stored Procedures. Check out the following sample stored procedure:

CREATE PROCEDURE [dbo].[UsingGUID]
@RowGuid char(36)
AS
BEGIN
        Select Name From Production.Product WHERE rowguid=(SELECT Convert(uniqueidentifier,@RowGuid))
END

Sincerely yours,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jonathan
Top achievements
Rank 1
answered on 22 Apr 2011, 10:03 PM
Is there no way to use Guids in the parameters? We are transitioning from SQL reporting to telerik and just want to reuse the stored procedures. In SQL reporting it accepts Guids, I would prefer not to make a copy of our stored procs with the parameters as strings because we have about 300 reports to build.
0
Massimiliano Bassili
Top achievements
Rank 1
answered on 22 Apr 2011, 10:21 PM
searching before asking is gold: http://www.telerik.com/support/kb/reporting/designing-reports/guid-as-report-datasource-parameter-type.aspx

Cheers!
Tags
General Discussions
Asked by
Stanislav Dudnyk
Top achievements
Rank 1
Answers by
Peter
Telerik team
Stanislav Dudnyk
Top achievements
Rank 1
Jonathan
Top achievements
Rank 1
Massimiliano Bassili
Top achievements
Rank 1
Share this question
or