Link to home
Start Free TrialLog in
Avatar of cmgtech
cmgtech

asked on

VB.NET, Crystal Reports. This property is currently in a read-only state and cannot be modified.

Hello,

I am running a Crystal Reports export to XML and am running into an issue.  I am using the COM object.  I get the error:  "This property is currently in a read-only state and cannot be modified." when I run my app sometimes.  It ishard to reproduce and the only way I can tell this is set off is by certain dates in my LASTRUN variable.  Sometimes dates will work and others won't.  The confusing thing is that index 0-4 will work fine and then when it gets to 5 it will error out.  Although other times, none of them will work.  I don't know and am very confused.

Thanks,

Mark


Here is the code:
Passing:
2004,11,12,00,00,00 as lastrun
5 as index
DataDump_Property as arr

    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("c:\" & 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=_____;;User ID=" & userid & ";;Password=" & pwd & ";;Locale Identifier=1033;;OLE DB Services=-5"
        rpt.DiscardSavedData()




        '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
        If index = 3 Or index = 0 Then
        Else
            rpt.RecordSelectionFormula = "{Command.UPDATE_DATE} >= DateTime(" & lastrun & ") OR {Command.INSERT_DATE} >= DateTime(" & lastrun & ")"
        End If
        '***end filter section

        rpt.ReadRecords()
        'export xml from crystal
        rpt.ExportOptions.DestinationType = CRAXDRT.CRExportDestinationType.crEDTDiskFile
        rpt.ExportOptions.FormatType = CRAXDRT.CRExportFormatType.crEFTXML
        rpt.ExportOptions.XMLFileName = "c:\xml\" & arr & ".xml"
        rpt.Export(False)
        rpt = Nothing
        cr = Nothing
Exit_code:
        Exit Function
Error_code:
        logger.WriteLine("Get\Error @ " & Now() & ": " & Err.Number & vbTab & Err.Source & vbTab & Err.Description, EventLogEntryType.Error)
        Resume Exit_code
    End Function
Avatar of Howard Cantrell
Howard Cantrell
Flag of United States of America image

What ver of CR are you running?
Avatar of cmgtech
cmgtech

ASKER

CR 9.  The problem only seems to happen for certain dates but that is only a guess... pretty new to this and I have lost a lot of sleep over this without being able to find any acceptable workaround or even an explaination or reason of this error.

Here is some of my error log:

Start: 11/30/2004 2:58:20 AM
For Dates: 2004,11,29,00,00,00
DataDump_L: 11/30/2004 2:59:16 AM
DataDump_R: 11/30/2004 2:59:23 AM
Get\Error @ 11/30/2004 2:59:26 AM: -2147417851      Interop.CRAXDRT      The server threw an exception.
DataDump_L: 11/30/2004 2:59:27 AM
DataDump_Lo: 11/30/2004 2:59:34 AM
Get\Error @ 11/30/2004 2:59:35 AM: -2147184634            This property is currently in a read-only state and cannot be modified.
DataDump_Loa: 11/30/2004 2:59:37 AM
Get\Error @ 11/30/2004 2:59:40 AM: -2147184634            This property is currently in a read-only state and cannot be modified.
DataDump_Pr: 11/30/2004 2:59:41 AM
Get\Error @ 11/30/2004 2:59:42 AM: -2147184634            This property is currently in a read-only state and cannot be modified.
DataDump_Pre: 11/30/2004 2:59:42 AM
DataDump_R(merge): 11/30/2004 2:59:45 AM
DataDump_Loa (merge): 11/30/2004 2:59:54 AM
DataDump_Lo (merge): 11/30/2004 3:01:18 AM
DataDump_L (merge): 11/30/2004 3:02:20 AM
DataDump_Pr (merge): 11/30/2004 3:02:34 AM
DataDump_P (merge): 11/30/2004 3:02:39 AM
Remove Nodes: 11/30/2004 3:02:44 AM
Passing to Update Page: 11/30/2004 3:02:44 AM
File Loaded, Posted.
Done Processing @ 11/30/2004 3:04:43 AM
******************************************
ASKER CERTIFIED SOLUTION
Avatar of Howard Cantrell
Howard Cantrell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cmgtech

ASKER

Thanks, I'll try it out later today and get back to you hopefully by tomorrow... a little busy lately.

Regards,


Mark
Avatar of cmgtech

ASKER

tried it out and i connect and can export to pdf fine with no errors.  the thing is, I dont know when this is going to crash out.  also I now have to export it to XML and con't find anything about how to do it anywhere.  with the CRAXDRT, I can just change portabledocumentformat to xml and it is fine.  no idea how to do it here and really con't find anyhting on how to do it.  

Thanks a lot, you really got me at least on the right track.


I am going to start a new thread that may help people find it easier.