简体   繁体   中英

Passing GUID through C# as parameter to Crystal Reports throws an error

My stored procedure has a GUID as a input parameter and at first it threw an error:

Type mismatch

That happened because I was passing it like a string. Then I did this:

Guid parameterGuid = Guid.Parse(parameterGuid);

MainReport.SetParameterValue(kvp.Key, parameterGuid,MainReport.Subreports["HeaderSubreport"].Name);    

And after that I got this error message:

Value does not fall within the expected range

So, after the search I took I saw that it needs to be passed as an array, but I am not sure how to do that.

Thanks.

If I recall correctly, Crystal Reports require the GUID to be enclosed with curly braces. So it looks like:

{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

You could do some string concatenation to achieve this. Or from Guid you can use ToString("B") .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM