Problems with USing Crystal report sin DTS

  • Hi,

    I am using the following code to run a crystal report:

    '**********************************************************************

    ' Visual Basic ActiveX Script

    '************************************************************************

    Function Main()

    Dim Application

    Dim Report

    Dim Table

    Dim Connection

    Dim Conn

    Dim Comm 'ADO Command

    Dim Rcdset 'ADO Recordset

    Dim Table1 'Crystal DatabaseTable

    Dim Tables

    Set Conn = CreateObject("ADODB.Connection")

    Set Comm = CreateObject("ADODB.Command")

    Conn.Open "Provider=SQLOLEDB.1;Initial Catalog=Shop2u2;App=Crystal Export;Data Source=vamcmaildb", "shop2udb", "19shop2u86"

    Comm.ActiveConnection = Conn

    Comm.CommandText = "shop2u2.dbo.usp_import_processing_report_Crystal"

    Comm.CommandType = 4

    Comm.Parameters.Append = Comm.CreateParameter("@client_id",200,1,20,"178")

    Comm.Parameters.Append = Comm.CreateParameter("@import_cell_list",200,1,500,"13779,13780,13781,13782,13783,13784,13785,13786,13787,13788,13789")

    Comm.Parameters.Append = Comm.CreateParameter("@segmented",200,1,200,"YES")

    Comm.Parameters.Append = Comm.CreateParameter("@suppres_cell",200,1,200,"")

    Comm.Parameters.Append = Comm.CreateParameter("@suppres_date",200,1,200,"")

    Set Rcdset = CreateObject("ADODB.Recordset")

    Set Rcdset = Comm.Execute( , , 4)

    If Rcdset.EOF Then

    Set Rcdset = Nothing

    Set Comm = Nothing

    Set Conn = Nothing

    Main = DTSTaskExecResult_Success ' Set as success as I don't need to know for my needs, set to fail it you do.

    Exit Function

    End If

    Set App = CreateObject("CrystalDesignRuntime.application.9")

    Set Report = App.OpenReport("\\S2uhost01\P_drive\Email List Processing\Data Specialist Job\reports\list_import_report\list_import_report.rpt")

    Set DB = Report.Database

    Set Tables = DB.Tables

    Set Table1 = Tables.Item(1)

    Table1.SetPrivateData 3, Rcdset

    Report.DiscardSavedData

    Report.ReadRecords

    ' Export the report to Excel file

    Report.ExportOptions.FormatType = 29

    Report.ExportOptions.DestinationType = 1

    Report.ExportOptions.DiskFileName = "C:\Testing_20041227.xls"

    Report.Export false

    ' Crystal Objects

    Set Table1 = nothing

    Set Tables = nothing

    Set DB = nothing

    Set Report = nothing

    Set App = Nothing

    ' ADO Objects

    Set Rcdset = Nothing

    Set Comm = Nothing

    Set Conn = Nothing

    ' Clean Up Objects

    Set Application = Nothing

    Set Connection = Nothing

    Main = DTSTaskExecResult_Success

    End Function

    It gives me a 'Microsoft OLEDB Provider error' with error on line no 30 whic h is : Set Rcdset = Comm.Execute(,,4).

    Any ideas???

  • This was removed by the editor as SPAM

  • I am trying to do the same thing. Import data from a crystal report v8.5 into an excel file. But I am not sure how I can connect to the crystal report.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply