I need your help, I have being trying to solve it for the past 2 months. Having problem trying to create a new row after filling the TEXTOBJECT using DATAREADER.
Here is the explanation why using Crystal Report TEXTOBJECT. Instead of creating alot of Crystal Reports for transactions reporting, it's better to use TEXTOBJECTs ( Eg. txtData1, txtData2, txtData3, txtData4, txtData5, etc...)
With these txtData as TEXTOBJECT name it creates the Crystal Report very flexible. The various Progams that extraction different transactions from SQL SERVER use DATAREADER and fill the rows of records into txtDATA object.
I am hoping that some VB.NET Crystal Report Developer will share their knowledge of how to create a new row after fill the txtDATA object instead of override the txtDATA objects like its happening right now. Instead of displaying 7 rows of data it display only the last row as it overrides the row before it.
-----------------------------------------------------------------------------------
Private Sub btnShowReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowReport.Click
Dim strSql As String = Nothing
strSql &= "Select OrderID, OrderDate, ProductName"
strSql &= " From Invoices "
strSql &= " Where CustomerId = '" & txtcustId.text & "' "
sqlConn = New SqlConnection(connStr)
sqlCmd = New SqlCommand(strSql, sqlConn)
sqlConn.Open()
sqlDR = sqlCmd.ExecuteReader
' ---- setup crystal Report option and TEXT Pbject defination ---- '
Dim objRpt As New CrystalOrderInvoice
Dim cryTextObject As TextObject = Nothing
Dim FmulaNewLine As FormulaFieldDefinition = Nothing
Dim cryFolder As String = "H:\GeneralCrystalReport\GenTrans.rpt"
objRpt.Load(cryFolder)
Me.CrystalReportViewer1.ReportSource = objRpt
Me.CrystalReportViewer1.Visible = True
While sqlDR.Read
' --- OrderID
cryTextObject = objRpt.ReportDefinition.ReportObjects("ctxtOrderId")
cryTextObject.Text = sqlDR("OrderID")
' --- OrderDate
cryTextObject = objRpt.ReportDefinition.ReportObjects("cTxtOrderDate")
cryTextObject.Text = sqlDR("OrderDate")
' --- productname
cryTextObject = objRpt.ReportDefinition.ReportObjects("cTxtProduct")
cryTextObject.Text = sqlDR("ProductName")
' --- new line
FmulaNewLine = objRpt.DataDefinition.FormulaFields("FmulaNewLine")
FmulaNewLine.Text = Chr(10) & Chr(13)
End While
sqlconn.Close
End Sub