How to generate a Crystal Report depending on the selected Item in a dropdownlist using vb?
Thanks,
Depending on the SelectedItem of combobox your sql query will be changed.....
So try something like...
[CODE=vbnet]
Dim mySqlString As String
Select Case mydrodown.Selec tedItem.Text
Case "FirstItem"
mySqlString="Se lect A From myTable1"
Case "SecondItem "
mySqlString="Se lect B From myTable2"
End Select
[/CODE]
1.now populate a DataSet (say myDataset) with query mySqlString
2.set your Crystal report(say myReport) DataSource property to myDataset
3.set your CrystalReportVi ewer(say myCRV) ReportSource property to myReport
try this.....
[CODE=vbnet]
If myDataset.Table s(0).Rows.Count = 0 Then
MsgBox("NO RECORD FOUND", MsgBoxStyle.Cri tical)
Else
Dim myReport As New CrystalReport1
myReport .SetDataSource( myDataset)
myCRV.ReportSou rce = myReport
End If
[/CODE]
Comment