-
May 1st, 2008, 02:07 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] parameter in crystal report
I enter a query in crystal report, and the query including parameter. How do I call this report in a form? (There are a textbox using to input parameter)
-
May 1st, 2008, 04:09 PM
#2
Hyperactive Member
Re: [2005] parameter in crystal report
This should do it for you.
VB Code:
Private Sub frmEligReport_Load( _
ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
Try
Dim NewReport As New ReportDocument
NewReport.Load("c:\MyCrystalReport.rpt")
' dtEligStart and dtEligEnd are the parameters
' from Crystal Reports.
' StartDate & EndDate are just global varibles that
' pull from datetime pickers on another form.
NewReport.SetParameterValue("dtEligStart", StartDate)
NewReport.SetParameterValue("dtEligEnd", EndDate)
NewReport.SetDatabaseLogon("User", "Pass", "Server", "Database")
CrystalReportViewer1.ReportSource = NewReport
Catch ex As Exception
MessageBox.Show( _
ex.Message & vbNewLine & _
ex.Source & vbNewLine & _
ex.StackTrace, "Error", MessageBoxButtons.OK)
End Try
End Sub
-
May 2nd, 2008, 10:56 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] parameter in crystal report
Thx, Thats really good answer
But I find that my parameter has some problem:
Code:
SELECT o.oDate, o.serialNo, o.dAddress, d.dName, d.dAddress, d.dNo FROM `order` o, di_detail did, di_set di, dealer d where o.serialNo = {?serialNo}
This is the command and supposed that {?serialNo} is equal to 1.
Code:
NewReport.SetParameterValue("serialNo", 1)
Now I drop out the o.dAddress into crystal report for testing but it loops all of my o.dAddress..Does anyone know what's going on?
-
May 2nd, 2008, 02:55 PM
#4
Re: [2005] parameter in crystal report
Use the Selection Expert to select records based on the parameter serialNo
-
May 3rd, 2008, 12:59 AM
#5
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|