Results 1 to 9 of 9

Thread: problem with Crystal Report and ADO command object [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member ahara's Avatar
    Join Date
    Nov 2003
    Location
    Toronto
    Posts
    531

    problem with Crystal Report and ADO command object [RESOLVED]

    Hello;

    I have been asked to modify an application as such:

    At present, each time the data is accessed, it is done with recordsets only (ie. recset.Open sql....etc). In order to improve performance on our Oracle database, I am changing all the queries and replacing the record sets with parameterized command objects. The following code is the way it was before I changed it:

    VB Code:
    1. Set rsQuery = New ADODB.Recordset
    2.  rsQuery.Open ("SELECT a.garage_id, TO_NUMBER(SUBSTR(a.workorder_no,21,10)) workorder_no, a.lessee, a.license, a.status, a.opendate, a.closedate, a.down_open, a.down_close, a.problem, a.total, a.credit, a.collator, a.vin, a.radio, a.vehicle_year, a.make, a.model, a.wo_odometer, a.odometer, a.unit_no, a.vehicle_no, a.suffix, lessee_data_a, a.credit_expiry, b.address1 FROM work_order a, garage_view b WHERE a.garage_id = b.garage_id AND a.workorder_no = '" & selectedWorkorder & "'"), DBConnection
    3. mainReport.Database.SetDataSource rsQuery
    4.  
    5. ...

    The above is a snippet from a block that prints a Crystal Report, and when the code is as above, it prints just fine. Here is the modififed code:

    VB Code:
    1. sql = "SELECT a.garage_id, TO_NUMBER(SUBSTR(a.workorder_no,21,10)) workorder_no, a.lessee, " _
    2.     & "a.license, a.status, a.opendate, a.closedate, a.down_open, a.down_close, a.problem, " _
    3.     & "a.total, a.credit, a.collator, a.vin, a.radio, a.vehicle_year, a.make, a.model, " _
    4.     & "a.wo_odometer, a.odometer, a.unit_no, a.vehicle_no, a.suffix, lessee_data_a, " _
    5.     & "a.credit_expiry, b.address1 FROM work_order a, garage_view b WHERE a.garage_id = " _
    6.     & "b.garage_id AND a.workorder_no=?"
    7.    
    8.     Dim testCommand As New ADODB.Command
    9.     Dim testPara As New ADODB.Parameter
    10.     testCommand.ActiveConnection = DBConnection
    11.     testCommand.CommandType = adCmdText
    12.    
    13.     Set testPara = testCommand.CreateParameter("workorder_no", adVarChar, adParamInput, 50, selectedWorkorder)
    14.     testCommand.Parameters.Append testPara
    15.    
    16.     testCommand.CommandText = sql
    17.    
    18.    
    19.     Set rsQuery = testCommand.Execute
    20.     mainReport.Database.SetDataSource rsQuery
    21.  
    22. ....

    With the above code, no error is raised whatsoever....the dialog for number of copies to print pops up, the print icon then appears in my system tray briefly after I click OK, AND NOTHING COMES OUT OF THE PRINTER!!

    Being new to Crystal Reports, I am wondering if I should know something about using a paramterized command object to open the record set rather than using the recordset.Open method, or perhaps something else I am missing! Any thoughts would be much appreciated
    Last edited by ahara; Mar 19th, 2004 at 11:03 AM.
    "Knowledge is gained when different people look at the same information in different ways"

    - Louis Pasteur

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