Parameters & UniqueIdentifiers

Stimulsoft Reports.NET discussion
Post Reply
jellis
Posts: 22
Joined: Wed Jun 27, 2007 5:28 am
Location: United Kingdom

Parameters & UniqueIdentifiers

Post by jellis »

Hi,

I have created a Parameter in my report which is a GUID called @ProjId

if I try to pass a value into it, I get a variety of errors as follows

If I pass in the GUID in any of these formats

f2ae04b3-ef47-4030-b897-4b005a523e7f
'f2ae04b3-ef47-4030-b897-4b005a523e7f'
{f2ae04b3-ef47-4030-b897-4b005a523e7f}

I get 'Input string was not in the correct format' followed by 'Failed to convert a parameter value from string to a guid.'

However if I embed the value into the report query directly inside single quotes, i.e;

WHERE ProjectId = 'f2ae04b3-ef47-4030-b897-4b005a523e7f'

The report executes as expected. SO my question is, how do I pass a GUID into a parameter?

Thanks,

Jon.

Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Parameters & UniqueIdentifiers

Post by Edward »

Hello, Jellis.

Please try the following expression:

Code: Select all

new Guid("f2ae04b3-ef47-4030-b897-4b005a523e7f");
P.S. For declaring of the variable with this sort of initializing please use Guid(Nullable) datatype.

Thank you.
jellis
Posts: 22
Joined: Wed Jun 27, 2007 5:28 am
Location: United Kingdom

Parameters & UniqueIdentifiers

Post by jellis »

Thanks Edward.

I actually achieved what I wanted by using a variable in my SQL statement and passing a value into that. Is there any advantage in using variables or parameters? They both seem to achieve the same thing?

Jon.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Parameters & UniqueIdentifiers

Post by Edward »

Hello, Jon.

In that case can be used variables as well as parameters. Meaning is the same. But assigning of the variables is possible outside the report from the main application, when the DataSource object is not created, but you need to assign a value.

Thank you.
Post Reply