Get crystal report data into XML format somehow using VB.NET

This is sort of a repost but a little more educated this time... I have crystal reports that I want to get into XML format.  I can achieve this using CRAXDRT COM object.  Using all this stuff: CrystalDecisions.CrystalReports.Engine, CrystalDecisions.ReportSource, CrystalDecisions.Shared.

The reason I want to use the .NET parts is because I get a bizarre error message sometimes when trying to export to XML in CRAXDRT:  -2147184634  This property is currently in a read-only state and cannot be modified.  This only happens when I try to filter by date... I think.  I cannot reproduce this error all the time.  It craps out pretty randomly and I cannot figure out why.  No incidents for 3 weeks and then I can't get the app to run for a week.

CRAXDRT has an XML export method built in and it is mind boggling that the .NET component does not.  I really think there should be a way to do this and I am going crazy because I have pretty much written off using CRAXDRT since I cannot figure out for the life of me what the issue is.  If there is an extra component that I need to use or could buy, please inform me as I am scared I might start crying at work int he next few days if this doesen't work for me.

It's really not that bad but getting close.
My .NET component code works fine and I havent gotten any error messages yet, I just need to get this data into XML.


Called with

        i = 0
        Do While i <= arr.Length - 1
            GetSG2_Data(arr(i), i, lastrun)
            i += 1

'arr(i) is 7 in length.

Private Function Get_Data(ByVal arr As String, ByVal index As Integer, ByVal lastrun As String) As Boolean
        On Error GoTo Error_code
        Dim rpt As CRAXDRT.Report
        Dim rpt_nd As MSXML2.IXMLDOMNode
        Dim filter_nd As MSXML2.IXMLDOMNode
        Dim cr As CRAXDRT.Application
        Dim userid, pwd As Object

        'new application
        cr = New CRAXDRT.Application()
        'crystal login info
        userid = ""
        pwd = ""

        'open specified report
        rpt = cr.OpenReport("S:\c\tech\Reports\" & arr & ".rpt")
        'only log in at application level if it is the first file, else max simultaneous users error
        rpt.Database.Tables(1).ConnectBufferString = "Provider=MSDAORA;;Data Source=w514p;;User ID=" & userid & ";;Password=" & pwd & ";;Locale Identifier=1033;;OLE DB Services=-5"

        '5/6/2003 12:00:00AM ---> DateTime(Y,M,D,H,M,S)
        'sets filter to the get all updates and inrts from last run date
        'lastrun = 2004,11,01,00,00,00 in this case
        If index = 3 Or index = 0 Then
            rpt.RecordSelectionFormula = "{Command.UPDATE_DATE} >= DateTime(" & lastrun & ") OR {Command.INSERT_DATE} >= DateTime(" & lastrun & ")"
        End If
        '***end filter section

        'export xml from crystal
        rpt.ExportOptions.DestinationType = CRAXDRT.CRExportDestinationType.crEDTDiskFile
        rpt.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTXML
        rpt.ExportOptions.XMLFileName = "c:\xml\" & arr & ".xml"
        rpt = Nothing
        cr = Nothing
        Exit Function
        logger.WriteLine("Get\Error @ " & Now() & ": " & Err.Number & vbTab & Err.Source & vbTab & Err.Description, EventLogEntryType.Error)
        Resume Exit_code
    End Function
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CR.Net is a reduced feature version of Crystal 9.  Crystal provided it to M$ as a way of tempting people to purchase the full version after getting a taste of the capability.

Crystal has done similar things with the trial versions and with some of the viewers.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Look at the feature comparison by version. CR.Net cannot export to XML directly.

You might be able to trick it by including th CR8 XML export dll.

cmgtechAuthor Commented:
I really cannot believe that this can happen.  It is embarassing that even though I own CR 9 Developer Pro and can export using the COM object, I can't use the .NET version.  Dammit.  

Thanks guys.
That was their intent with CR.Net.  To create a desire to get the other features.

Glad i could help

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.