Solved

Crystal Reports & VB6 - Retrieving SQLQueryString property

Posted on 2004-09-29
9
615 Views
Last Modified: 2012-08-14
We are trying to retrieve the SQLQueryString from a report and getting an emptystring.
When stepping through in code it works fine and puts the string into a variable but in compiled app it fails to retrieve value.

Any ideas (or maybe a better question)

Ray
0
Comment
Question by:rfoconnor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 12182531
Is there a reason to retrieve the string?

What code are you using to retrieve the string?

mlmcc
0
 
LVL 13

Expert Comment

by:vidru
ID: 12182535
Can you post the code you're using?  Also, your version of Crystal, DB, and connectivity would be helpful.

I just ran a quick test using an ODBC connection to the CR Extreme sample db using CR8.5/VB6/RDC, and was able to successfully retreive the SQLQueryString from the report.  I did notice that when I was trying to access the SQLQueryString property, it would invoke the parameter window.

For example, this would invoke the parameter window once:
  Set rpt = cApp.OpenReport("c:\regions.rpt")
  strQry = rpt.SQLQueryString
  CRViewer1.ReportSource = rpt
  CRViewer1.ViewReport

This will cause the parameter to be invoked twice, but if two different values are entered, the report will reflect the first (invoked from ViewReport), but the SQLQueryString will reflect the second:
  Set rpt = cApp.OpenReport("c:\regions.rpt")
  CRViewer1.ReportSource = rpt
  CRViewer1.ViewReport
  strQry = rpt.SQLQueryString

-dave
0
 

Author Comment

by:rfoconnor
ID: 12191632
retrieving the string to modify it.

code as follows
'==========================================
sTableName = objCRTable.Location
if sTableName = "" then
    ' do error stuff and exit
end if

sSQL = objCRRpt.SQLQueryString
if sSQL = "" then
    ' do error stuff and exit
end if

' code to replace the tablename with the name of a CSV file generated from a query earlier
'==========================================

The problem occurs with line
sSQL = objCRRpt.SQLQueryString

When running the compiled object and occaisionally when running in debug sSQL is empty.
When stepping through the code more slowly it is populated properly every time.

Almost as if "objCRRpt.SQLQueryString" is running asynchronously



0
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
LVL 42

Expert Comment

by:frodoman
ID: 12192294
Could be waiting for a response to build the SQL.  Have you tried simply putting a small "wait" or "sleep" in front of this line of code?
0
 

Author Comment

by:rfoconnor
ID: 12193901
We considered this but don't feel keen on putting in a "sleep" or similar with no way of knowing when the property has been returned.  May have to though.
0
 

Author Comment

by:rfoconnor
ID: 12274588
Did try putting a wait loop in but to no avail.

The problem seems to be opening the template.  Sometimes it works and sometimes it doesn't.
0
 

Author Comment

by:rfoconnor
ID: 12537525
Hi there

I found the answer by completely taking down Crystal Reports and re-installing it.

ALl I can think of is that there was a rogue DLL from an older version hanging around
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12572823
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

718 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