开发者

Get selected records in Crystal Reports from SQL Tables

This might be a very small question for SQL and Crystal Experts.

For e.g. I have a Table of Names

ID    Name
1     John Smith
2     Boris Berker
3     Alex Mathew
4开发者_JS百科     John Abraham
5     Melisa Estate
6     Willam Schweizer

Now in crystal report I just want to display lets say ID-1,4 and 6.

How can I do it. I will get the final IDs to display in C# List. But then how to pass it as parameter to crystal reports.

I use selection formula of crystal reports.

{Name.ID}={ID}     

where {Name.ID} is SQL Column and {ID} is crystal report parameter, but then it would display all the records. Is there a way such that I can pass my list to ID parameter of crystal reports.

I hope I am clear.

Thank you in advance


First of all in your Crystal Report you will need to amend your parameter to accept multiple values:

Get selected records in Crystal Reports from SQL Tables

In your Selection Expert you need to use a formula and have the following:

{OBJECTNAME.COLUMN_NAME} = {?ID}

Then in your C# code you will need to iterate through the C# List and add each value to the Crystal Report parameter using AddCurrentValue

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜