Please i need help for my new project:

I want to create a crystal report that pass parameters from my code. Like what i have done in vb6.

IN VB6 i made a report design without by data sources: i just fill the report with

rptTextBox
and
rptLabel

then in my code i pass the value to the report parameters using hard code:

Private Sub cmdPrint_Click()
Connect

rs.StayInSync = True
rs.Open "SHAPE {select ClientNo, ClientName, LoanDate, Maturity, Figure, SOANo, Address from tblstatementofaccount} " & _
"APPEND ({select ClientNo, ClientName, ORNo, Collector, Amount, Date from tblclientledger} " & _
"AS ClientNos RELATE ClientNo TO ClientNo)", _
con
Set dtrClientLedger.DataSource = rs

dtrClientLedger.Sections.Item("Section2").Controls.Item("Label5").Caption = Me.txtClientName.Text
dtrClientLedger.Sections.Item("Section2").Controls.Item("Label7").Caption = Me.txtAddress.Text
dtrClientLedger.Sections.Item("Section2").Controls.Item("Label9").Caption = Me.txtClientNo.Text
dtrClientLedger.Sections.Item("Section7").Controls.Item("Label21").Caption = Me.txtBalance.Text

With dtrClientLedger.Sections.Item("Section6").Controls
.Item("Text5").DataField = rs.Fields("LoanDate").Name
.Item("Text6").DataField = rs.Fields("Maturity").Name
.Item("Text7").DataField = rs.Fields("SOANo").Name
.Item("Text8").DataField = rs.Fields("Figure").Name
End With
With dtrClientLedger.Sections.Item("section1")
.Controls("Text1").DataMember = "ClientNos"
.Controls("Text2").DataMember = "ClientNos"
.Controls("Text3").DataMember = "ClientNos"
.Controls("Text4").DataMember = "ClientNos"

End With
With dtrClientLedger.Sections.Item("Section7")
.Controls("Function1").DataMember = "ClientNos"
End With
With dtrClientLedger.Sections.Item("Section1").Controls
.Item("Text1").DataField = "Date"
.Item("Text2").DataField = "ORNo"
.Item("Text3").DataField = "Collector"
.Item("Text4").DataField = "Amount"

End With
With dtrClientLedger.Sections.Item("section7").Controls
.Item("Function1").DataField = "Amount"
End With



dtrClientLedger.Show 1


rs.Close

End Sub

NOW CAN I DO THIS IN C# CRYSTAL REPORT? PLEASE HELP ME...

The code posted here binds data source to the "DataReport" (VB6). It is not a CrystalReport.

I'd like to suggest a good book to learn Crystal Report from the scratch.

Ok i will read it, but anyone has any idea? I hate creating Dataset1.xsd. I want to design my crystal report using TextObject and populate it using my code. I mean that I want to query my "dataset" using "Select" statement in my form then push it to CrystalReport.

Any idea please, I would appreciate it. thanks.

This article has been dead for over six months. Start a new discussion instead.