Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my application I used crystal report.

VB
dim str as new string
str="select table1.*,table2.* from table2 inner join table1 on              table1.id=table2.code where table1.id=1500
Dim mycmd As New SqlCommand
mycmd.Connection = roConform
mycmd.CommandText = StrSQl
mycmd.CommandType = CommandType.Text
Dim myda As New SqlDataAdapter
Dim myds As New DataSet
myda.SelectCommand = mycmd
myda.Fill(myds, "table")
Dim crptReport As New CryFamilyMembers1
crptReport.SetDataSource(myds)
CRViewer.ReportSource = crptR



Query result is correct but crystal report populated all records
Posted
Updated 9-Sep-10 23:42pm
v2

1 solution

Hello,

Acc to what i have used upto now, when you are using a query to send data to database, you should Command and not direct tables from database in Crystal reports.

If you are using tables, you need pass the Condition for filtering records in crystal reports using RecordSelectionFormula as below.

report.RecordSelectionFormula = [Conditions]

eg.{table1.ID}>1 and {table1.ID}<10 will display records with ID between 1 and 10.

hope that answers your question.
 
Share this answer
 

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