[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Crystal Reports & VB6 - Retrieving SQLQueryString property

Posted on 2004-09-29
9
Medium Priority
?
633 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
8 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
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.

 
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…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 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