I have a table name logs that holds the accomplishments log of the employees in a particular organization
ID
User_ID
Logs
StartDate
StartTime
FinishedDate
FinishedTime
I want only to print based on two user inputs. The User_ID and FinishedDate. How to achieve it using Crystal Report?
This assumes you already have a report displaying data from that table (and you don't already have parameters in your report):
- Create the parameters user_Id and FinishedDate in your crystal report - right click parameter fields, and add new
- Click the Report menu, then "Select Expert"
- Pick the field from your data base, and choose whether you want it to be equal to you parameters
- You can customise the selection criteria in the formula editor
To apply these parameters from your VB application after data binding, you need to call the SetParameterValue method on the report object as follows:
report.SetParameterValue("User_Id", 1256)
report.SetParameterValue("FinishedDate", date)
Edit
You'll need to research loading data into your report in more detail. Your question was how to pass parameters to crystal from VB.net. Below is a brief run through:
' Create a report document - pointing to your .rpt file
report = new ReportClass()
report.FileName = fileName
' Assign the report object to your viewer
ReportViewer.ReportSource = report
' perform any database logon
report.SetDatabaseLogon(...credentials...)