CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual Basic Programming > Crystal Reports
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old March 18th, 2004, 08:18 AM
    ahalyal ahalyal is offline
    Junior Member
     
    Join Date: Mar 2004
    Posts: 1
    ahalyal is an unknown quantity at this point (<10)
    Angry Calling store procedure in Report throu VB

    Dears


    How to call store procedure in Crystal Report through VISUAL BASIC. i have Sp which has 3 parameters one is string others are dates parameter ,
    how to to in the visual basic coding.

    can any one help me passing paramerters .

    Thanks
    Annu
    Reply With Quote
      #2    
    Old August 24th, 2004, 04:57 PM
    ika ika is offline
    Junior Member
     
    Join Date: Aug 2004
    Posts: 1
    ika is an unknown quantity at this point (<10)
    Re: Calling store procedure in Report throu VB

    For Vb 6:

    Get rs (Recordset) calling stored procedure with parameters

    After:

    Dim report As CRAXDRT.report



    Set report = crystal.OpenReport(App.Path & _
    IIf(Right(App.Path, 1) = "\", "", "\") & _
    s_Rpt & GetAdditionalNamePart(s_Rpt) & ".rpt") 'OPEN REPORT

    report.Database.LogOnServerEx _
    "crdb_odbc.dll", _
    c_Settings.GetVal(CRYSTALDSN), _
    c_Settings.GetVal(DBNAME), _
    c_User.Name, _
    c_User.Password, , _
    c_Db.ConnectionStr
    report.DiscardSavedData 'CLEARS REPORT SO WE WORK FROM RECORDSET
    report.Database.SetDataSource rs 'LINK REPORT TO RECORDSET

    Load frmReport
    'ShowSendButton s_Rpt, frmReport.crV, frmReport.cmdSend


    'crV - crystal viewer control
    frmReport.crV.ReportSource = report 'LINK VIEWER TO REPORT
    frmReport.crV.ViewReport


    Best,

    ika
    Reply With Quote
      #3    
    Old August 25th, 2004, 11:18 AM
    malleyo malleyo is offline
    Member +
     
    Join Date: Jul 2003
    Location: Florida
    Posts: 651
    malleyo has a spectacular aura about (125+)malleyo has a spectacular aura about (125+)
    Re: Calling store procedure in Report throu VB

    This is using VB 6 and CR 8.5 with RDC...

    You can get your data from the Stored Proc through ADO and then pass the ADO recordset to Crystal:

    Code:
        'dsrReport is the name of your dsr file
        Dim Report As New dsrReport
    
        Set cmdData = New ADODB.Command
        Set rsData = New ADODB.Recordset
        cmdData.ActiveConnection = cnConnection
        cmdData.CommandText = "sp_StoredProcName"
        cmdData.CommandType = adCmdStoredProc
        cmdData.Parameters.Refresh
        cmdData.Parameters("@Param1") = strParam1
        cmdData.Parameters("@Param2") = dtmParam2
        cmdData.Parameters("@Param3") = dtmParam3
        
       'Required for RecordCount to return an accurate count
        rsData.CursorType = adOpenDynamic
        rsData.CursorLocation = adUseClient
        rsData.Open cmdData
        
        If Not rsData.EOF Then
             Report.DiscardSavedData
             Report.Database.SetDataSource rsData, 3, 1   
        End If
    __________________
    I'd rather be wakeboarding...
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual Basic Programming > Crystal Reports


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 11:35 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009