Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i need to pass many of ids type integer selected by user and include it as array in selection formula by sql query to get data from sql server to crystal report

it show me an error msg
when try to show crystal report
it say ...
the ) is missing.

when i copy the code in sql sever qury its work..

What I have tried:

VB
Dim ListOfSortedID As New List(Of Integer)
 Dim IDs As String = Nothing

 IDs = String.Join(",", ListOfSortedID)

        Where4Crystal ="{DutyView.EmpAutoID} in (" & IDs & ")"
Posted
Updated 22-Aug-19 20:04pm
v2
Comments
Maciej Los 23-Aug-19 1:56am    
What's error message?

1 solution

Try this:
VB
Dim ListOfSortedID As New List(Of Integer)
'later
Dim IDs As String = String.Join(",", ListOfSortedID)
Where4Crystal = String.Format("{DutyView.EmpAutoID} in [{0}]", IDs)


You need the square brackets aroung IN operator.

Note: as far as i remember there's limitation to 32 arguments in IN operator.
 
Share this answer
 
v2
Comments
Member 11398913 23-Aug-19 8:01am    
Still not work ? if there any other way , because ther are another paramaters for Where4Crystal string for query.
Maciej Los 23-Aug-19 8:08am    
An how you use them? Like this:
Where4Crystal = String.Format("({DutyView.EmpAutoID} in [{0}]) AND ({TextField}='{1}')", IDs, "some text")
Member 11398913 23-Aug-19 18:38pm    
thank alot for your support, i just change the ( IDs ) in code to [ IDs ] and it work now, i really apreciate your help.
Maciej Los 25-Aug-19 13:43pm    
You're very welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900