Solved

Dictionaries and Out of Memory error....

Posted on 2002-04-23
21
2,186 Views
Last Modified: 2011-09-20
Hi, this is a bit of a bizarre error (at least it seems that way to me!).  Would appreciate any help anyone could give.  Background info...

I'm writing a reports viewer in VB using the Crystal Reports viewer control.  The data is coming from an ODBC DSN and the report was generated using the DSN via a Crystal Dictionary.  At run time I have to change the ODBC DSN to the correct dataset and to do this I use the SetLogOnInfo of the Database Table object.

The symptoms of my problem are this...

If the report is distributed without the dictionary my viewer runs fine.  If the dictionary is available and I open the report using the normal Crystal Designer program, firstly it asks me to locate the dictionary, if I do and save the report again when I try to open that same report via my viewer I get an Out of Memory (7) error.  Renaming the dictionary gets the report working again, but as soon as the dictionary has its original name and location the report viewer errors up.

Not sure that I've explained myself very well so clarifying questions are very welcome.

Thanks,

Julian
0
Comment
Question by:JulianDavies
  • 10
  • 8
  • 2
  • +1
21 Comments
 
LVL 6

Expert Comment

by:dbirdman
ID: 6963547
I have not run across this problem, though here are a couple of links with info that might be of assistance:

http://support.crystaldecisions.com/library/kbase/articles/c2009321.asp

http://support.crystaldecisions.com/communityCS/TechnicalPapers/cr_memoryfull.pdf.asp

Hope this helps.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 6964371
WHat code are you using to view the report?

Is your code used to generate the dictionary or is it only CR?

mlmcc
0
 

Author Comment

by:JulianDavies
ID: 6965006
Thanks dbirdman... will take a look at those articles and let you know how it goes.

mlmcc, the code I'm using is....

Private Sub ShowReport()

Dim objDatabase As CRAXDDRT.Database
Dim objEngine As New CRAXDDRT.Application
Dim objReportObject As Object
Dim objSection As CRAXDDRT.Section
Dim objSubReport As CRAXDDRT.Report
Dim objSubReportObj As CRAXDDRT.SubreportObject
Dim objTable As CRAXDDRT.DatabaseTable

    Set mobjReport = objEngine.OpenReport(mstrReport)

' Are we re-directing to a different datasource?
    If mblnRedirect= True Then
        ' Get the database for this report
        Set objDatabase = mobjReport.Database
       
        ' Log onto the server
        objDatabase.LogOnServer "pdsodbc.dll", mstrDataSource, mstrDataSource, "root"

        ' Redirect to the correct dataset
        For Each objTable In objDatabase.Tables
            Call objTable.SetLogOnInfo(mstrDataSource, mstrDataSource, "root")
            If objTable.TestConnectivity = False Then
                MsgBox "An error occured while setting the data source for this report.  Please confirm that the linkage between company and data source is correct.  (Tools/Options/Data Sources)", vbOKOnly + vbExclamation, Me.Caption
                Exit Sub
            End If
        Next objTable
       
        ' Loop through the report sections
        For Each objSection In mobjReport.Sections
            ' Loop through the section objects
            For Each objReportObject In objSection.ReportObjects
                ' Check the type
                If objReportObject.Kind = crSubreportObject Then
                    ' Get hold of the report
                    Set objSubReportObj = objReportObject
                   
                    ' Open the report
                    Set objSubReport = objSubReportObj.OpenSubreport
                   
                    ' Get the database for this report
                    Set objDatabase = objSubReport.Database
                   
                    ' Loop through the tables
                    For Each objTable In objDatabase.Tables
                        Call objTable.SetLogOnInfo(mstrDataSource)
                    Next objTable
                End If
            Next objReportObject
        Next objSection
    End If

    mobjReport.DiscardSavedData

    crvViewer.ReportSource = mobjReport
    crvViewer.ViewReport

End Sub

Thanks!
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6966834
I believe that with this line of code

       objDatabase.LogOnServer "pdsodbc.dll", mstrDataSource, mstrDataSource, "root"


you are telling CR to use the 16 bit ODBC drivers.  You might want to use "p2sodbc.dll" instead.

DRRYAN3
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 6967030
You're right DRRYAN3.

mlmcc
0
 

Author Comment

by:JulianDavies
ID: 6967931
Thanx DRRYAN3 and mlmcc, I've made that change, but I'm still getting the out of memory error if the .dc5 file is in the place that the .rpt expects it to be.

Any more idea's?

Sorry!
0
 

Author Comment

by:JulianDavies
ID: 6967953
Not sure if this will help, but....

While I was stepping through the code I put a watch on the objTable object when it was about to do the objTable.TestConnectivity line.  The line failed sometimes when it succeded properties such as Location were populated.  When it failed the object reported that Location was "Not Supported", along with a couple of other properties that had been previously populated.  Also, the property that holds the DLL name was empty.

Thanx,

Julian
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6968784
Try using CRAXDRT instead of CRAXDDRT when declaring your variables.  CRAXDDRT requires a royalty payment when distributed.

At what line in the code you've provided do you get the out of memory error?  Is it when you call the view method, or is it before that point?
0
 

Author Comment

by:JulianDavies
ID: 6968915
DRRYAN3, I've changed over to CRAXDRT - I didn't realise it had royalty payments required - thanks!

The error occurs when I do the...
If objTable.TestConnectivity = False then

... line, but if I allow it to carry on beyond that point it errors when I do the...
crvViewer.ViewReport

0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6976253
I'd bet that the problem is in the

Call objTable.SetLogOnInfo(mstrDataSource, mstrDataSource, "root")

line of code.  What is your backend database?  What does your mstrDataSource string look like?  Did you use the ODBC drivers when you designed your report, or did you use the Crystal drivers native to your database?

DRRYAN3
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:JulianDavies
ID: 6976877
mstrDataSource holds the name of an ODBC DSN, and the one I used was called "bb live.udd".  The same one was used on the design machine as was used on the viewer machine.

That DSN uses a Transoft driver for C-ISAM files residing on a Unix server.

Hope that helps!

Thanks,

Julian
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6977612
Do you have any problems using this arrangement with ordinary ADO recordsets which are similar to what you are trying to pull into your report?  Still sounds like a database connectivity issue to me.
0
 

Author Comment

by:JulianDavies
ID: 6977725
I've never tried using the viewer with an ADO recordset, just this ODBC driver.  If it's a connectivity issue how come the report always works in Crystal Designer, using the same Crystal Dictionary and ODBC driver?  Is the syntax I'm using to connect in the viewer wrong?
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6977993
Here is the code I use to accomplish a data source switch:

dim crRept as CRAXDRT.REPORT
dim crDBTab as CRAXDRT.DATABASETABLE

set crRept = crApp.OpenReport("whatever.rpt")
crRept.Database.Logonserver "p2ssql.dll", "SERVERNAME","DBNAME", "USERID", "PASSWORD"
for each crDBTab in crRept.database.tables
  crDBTab.setlogoninfo "SERVERNAME","DBNAME","USERID","PASSWORD"
next

This code works 100% of the time for me with MS SQL OLEDB drivers and I switch on the fly to about 6 different servers.  The only difference I see between this code and yours are that you appear to have the server and database name set to the same value.

When I asked about the ADO recordset, I was wondering if you were able to setup a recordset and step through it in code, not in the report.

I've assumed so far that you have compared the DLL versions on the development and production machines.  Are they the same?  Are there duplicates in different directories?

DRRYAN3
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6980635
Quoting from the online guide for 8.5...

"Dictionaries simply provide all of the convenience with the restrictions." and "... dictionaries are optional components.  Data can still be access directly by the user."

After re-reading your problem statement, I think you may have misunderstood the point of the Crystal Dictionaries.  When you use them, you are basically locking the report into whatever data source and set of fields the dictionary designer has decided you should see.  You cannot use the dictionary with another data source, for example.

It appears you are distributing your report(s) as part of an application.  In this case, why the dictionaries?  Just go to the ODBC data source and do the reporting.  Your technique is correct if you omit the dictionary.  There is not an API that I can find, however, for modifying the dictionary from code, which will prohibit you from being able to access alternate data sources on the fly while using a dictionary.

DRRYAN3
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6983954
Are you coming back?
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6987869
JulianDavies

I ask again, are you coming back?  Have you made any progress?  Do you disagree with my last comment or did it not help?

DRRYAN3
0
 

Author Comment

by:JulianDavies
ID: 6988107
Sorry for the delay in replying.

My understanding was that the dictionary allowed you to make life easier for the report designer by giving them a set of tables with helpful field names (aliases) and ready-linked... a sort of data map.   Once compiled I believed that this map was stored (in some form) in the report itself with a reference to the dictionary that helped generate it.  (Not sure if I've explained myself too well there, but that's how it seems to me)

So coming back to what you said, yes, I know the designer can get straight to the underlying data and by-pass the dictionary, but it's not in their interest to do so due to the complexity of the full data-set (and hence we produce a simplified sub-set in a dictionary).  But I disagree that using a dictionary locks the report completely because that same report, when the dictionary is not available, can still work and can be re-directed to a different datasource - I've already done that bit!!

Back to my problem, I know I can't do anything to the dictionary at run-time (nor do I need to), but if the dictionary file is just present the viewer fails to load the report if I change the reports datasource by the normal methods.  That is what I want to over-come, it seems to me that if the dictionary is present the report interacts with it some how and a side-effect of that interaction is the problem I'm experiencing.

Does any of that help, sorry it's a bit waffly,

Thanks,

Julian
0
 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 500 total points
ID: 7010136
JulianDavies:

I think this article from the CrystalDecisions web site addresses the balance of your issues:  The short answer is that you are trying to use the dictionaries at run-time and they are a design-time only tool.

(See http://support.crystaldecisions.com/library/kbase/articles/c2005632.asp for full article)

Synopsis

What issues cause Crystal Queries (QRY files) and Dictionaries (DCT files) to be undesirable for development purposes, and what are possible alternative solutions?

Solution

Crystal Queries and Dictionaries are tools which are only designed to be used in conjunction with the Crystal Reports Designer. They are not designed to be used in a runtime environment with either Compiled Reports or a Crystal development tool such as the Crystal OCX Control or Report Designer Component (RDC).

A common error which occurs when using Crystal Queries or Dictionaries with the Crystal Print Engine is a 599 or 20599 error (Cannot Open SQL Server). Here are reasons why this error (and others) can occur when using Crystal Queries or Dictionaries:

· The location of the data source (ie. path to the QRY file) cannot be modified at runtime. This means that the path to where the data source is located must be identical for all machines where the report is run. For example, if a report is created off a Crystal Query located in the folder C:\Query, then the same folder name must exist on every machine where the report will be run. Every client machine needs to have the QRY file located in this directory. It is not possible to specify a different location for a QRY file at runtime.

· Passing log on information through Crystal Queries or Dictionaries may lead to complex connectivity issues. Saving a query file with no data (in the SQL Designer under the 'File' menu, the 'Save Data with Query' item is not selected) may lead to problems with passing log on information to the server database. If you are refreshing a report to the server database every time it is run, then a Crystal Query or Dictionary will add an extra layer for passing log on information to the server database. This also effects how quickly records are read from the server database..

· Crystal Queries or Dictionaries cannot be used with subreports when log on information is required.

· You cannot convert a report's database driver when reporting off a Crystal Query or Dictionary. For example, a report originally created off a QRY file cannot be changed to report directly off an Oracle table or view. The report must be recreated.


================================

Suggested alternatives to using Crystal Queries or Dictionaries are:

· Create a query or view within the database itself. Several of Crystal Reports database drivers support reporting directly off a database query or view.

· Create a Stored Procedure which returns a customized set of records according to parameter values.

· Use Active Data. Crystal Reports ships an Active Data Driver (P2smon.dll) which reports off DAO, RDO, and ADO recordsets at runtime. A recordset object created in an application can be passed directly to a report at runtime. Note that this option is not available with compiled reports.

0
 

Author Comment

by:JulianDavies
ID: 7010455
Well, that explains what's going on!  Thanks for all your help DRRYAN3.... u definitely deserve the points.

Cheers,

Julian
0
 
LVL 12

Expert Comment

by:DRRYAN3
ID: 7011002
Glad to help
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now