I have sets of data in my database and I want to display the data based on CramNo but upon processing, the report displays all the sets of data and did not fetch it based on the where clause.
Here is my code for selecting the data for the crystal report
Dim selMainCram As New SqlDataAdapter("SELECT * FROM CRAMBMain WHERE CramNo = '" & cramNo & "'", jonsqlcon)
Dim setMainCram As New DataSet
selMainCram.Fill(setMainCram)
Dim cryRptB As New ReportDocument
cryRptB.Load(reportsfolder + "CRAMtest.rpt")
Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
Dim crTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim ConnInfo As New CrystalDecisions.Shared.ConnectionInfo()
With ConnInfo
.ServerName = tmpSN
.DatabaseName = tmpDBN
.UserID = tmpUID
.Password = tmpPass
End With
For Each crTable In cryRptB.Database.Tables
crTableLogonInfo = crTable.LogOnInfo
crTableLogonInfo.ConnectionInfo = ConnInfo
crTable.ApplyLogOnInfo(crTableLogonInfo)
Next
cryRptB.SetDataSource(setMainCram)
Me.CrystalReportViewer1.ReportSource = cryRptB
Me.CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.IntegratedSecurity = False
Me.CrystalReportViewer1.Refresh()
Me.Show()