Results 1 to 5 of 5

Thread: CR & VB Not returning expected results?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member Pozzi's Avatar
    Join Date
    Feb 2001
    Location
    The Stones!
    Posts
    507

    Question CR & VB Not returning expected results?

    I'm running a report within a VB wrapper. However the data returned isn't what's expected.

    Attached is what I get returned when running the following code: -

    VB Code:
    1. Option Explicit
    2.  
    3. Dim crxApp As New CRAXDRT.Application
    4. Dim CRXRpt As CRAXDRT.Report
    5. Dim CRXDB As CRAXDRT.Database
    6. Dim CRXTbl As CRAXDRT.DatabaseTable
    7.  
    8.  
    9. Private Sub Form_Load()
    10.  
    11. Dim rs As ADODB.Recordset
    12. Dim cn As ADODB.Connection
    13. Dim crxReport As CRAXDRT.Report
    14. Dim crxApp As CRAXDRT.Application
    15. Dim crxTable As CRAXDRT.DatabaseTable
    16. Dim sql As String
    17.  
    18. Set cn = New ADODB.Connection
    19. Set rs = New ADODB.Recordset
    20. Set crxApp = New CRAXDRT.Application
    21. Set crxReport = crxApp.OpenReport("C:\Test.rpt", 1)
    22.  
    23. sql = "SELECT TB_CASHREGS.DESCRIPTION, TB_TRANS_CARDS.LOAD_CASH, TB_TRANS_CARDS.SALDO_CASH, " & _
    24.                 "TB_CUSTOMERS.CARD_NUM, TB_CUSTOMERS.DESCRIPTION " & _
    25.                 "FROM TB_TRANSACTIONS, TB_CASHREGS, TB_CUSTOMERS, TB_TRANS_CARDS " & _
    26.                 "WHERE  TB_TRANSACTIONS.CASHREG_ID = TB_CASHREGS.ID " & _
    27.                 "AND TB_TRANSACTIONS.CARD_NUM = TB_CUSTOMERS.CARD_NUM " & _
    28.                 "AND TB_TRANSACTIONS.ID = TB_TRANS_CARDS.TRANSACTION_ID " & _
    29.                 "AND TB_TRANSACTIONS.CARD_NUM = '1052'"
    30.  
    31. cn.Open "Provider=OraOLEDB.Oracle; Data Source=tcpos; User Id=lyons; Password=matrix;"
    32.  
    33. rs.Open sql, cn, adOpenKeyset
    34.  
    35. 'now verify all tables within the report
    36.  For Each crxTable In crxReport.Database.Tables
    37.       With crxTable.ConnectionProperties
    38.         .Item("Provider") = "OraOLEDB.Oracle"
    39.         .Item("Data source") = "tcpos"
    40.         '.Item("Initial Catalog") = " " 'if none, use ""
    41.         .Item("User ID") = "lyons"
    42.         .Item("Password") = "matrix"
    43.       End With
    44. Next
    45.  
    46.     crxReport.DiscardSavedData
    47.     crxReport.Database.SetDataSource rs
    48.      
    49.     CRViewer91.ReportSource = crxReport
    50.     CRViewer91.ViewReport
    51.    
    52. End Sub

    This isn't the same as when run through crystal or when the query is run directly against the DB.

    As can be clearly seen the records are just the first repeated.

    Any idea what I've missed?

    I've looked through the Crsytal help, but nothing, to be honest not the best on-line help

    Any help would be appreciated.

    Regards
    Attached Images Attached Images  
    Last edited by Pozzi; Jun 3rd, 2004 at 06:06 AM.
    VB.Net (VS 2010)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width