Link to home
Start Free TrialLog in
Avatar of _Canidae_
_Canidae_

asked on

Passing SQL to Crystal Reports

How do I pass an SQL statement to my report, and how is the report set up to handle this?

I'm not sure if answering this question will take a lot of typing or what, so I'll increase the points if necessary.

Bear in mind that I'm relatively new to ASP.  This is the 2nd time I'm asking this question, the first time nobody even commented.  Please help.
Avatar of TTom
TTom

Hi!

I think I may be able to help with this, but I have to find some time to look at an application I am working with.  The prospect was a bit time consuming, which is why I didn't respond right away.

Will try to get back to you later today.

Tom
Avatar of _Canidae_

ASKER

Thanks.  I've read lots of documentation and not found any way to do it (passing SQL), but there's another way which I'm busy with right now and it seems to be working.

Here's an example of one of my statements:

NextForm.action="Report3.rpt?sf={INCI.9}+%3d+'" & NextForm.Company.value & "'"

So I'm unsure of whether I'm going to need to pass SQL.  This seems to do the job!
If it works for you...

I'll still take a look at the SQL thing if I get a chance.  Good for me to do anyway.

Tom
Thanks :o)
ASKER CERTIFIED SOLUTION
Avatar of Roopesh_Mohan
Roopesh_Mohan

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
Thanks Roopesh_Mohan for your proposed answer.  Unfortunately I have to leave now, so I'll only be able to test your answer tomorrow.
I'm getting this when I use your answer:

--------
cpeaut32 error '800a4e20'

No error.
--------

Ummm, confused.
Try Now...


<!-- #include file="SmartViewerActiveX.asp" -->

And
Save this below text as a "SmartViewerActivex.Asp"
---------------------------------
<%
'This file contains the HTML code to instantiate the Smart Viewer ActiveX.      
'                                                                    
'You will notice that the Report Name parameter references the rptserver.asp file.
'This is because the report pages are actually created by rptserver.asp.
'Rptserver.asp accesses session("oApp"), session("oRpt") and session("oPageEngine")
'to create the report pages that will be rendered by the ActiveX Smart Viewer.
'
%>
<HTML>
<HEAD>
<TITLE>Seagate Crystal Smart Viewer for ActiveX</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD="Page_Initialize">

<OBJECT ID="CRViewer"
      CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
      WIDTH=100% HEIGHT=95%
      CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=7,0,100,52">
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableGroupTree" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=1>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
</OBJECT>

<SCRIPT LANGUAGE="VBScript">
<!--
Sub Page_Initialize
      On Error Resume Next
      Dim webBroker
      Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
      if ScriptEngineMajorVersion < 2 then
            window.alert "IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE 3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are available at Microsoft's web site."
            CRViewer.ReportName = Location.Protocol + "//" + Location.Host +"/scrreports/rptserver.asp"
      else
            Dim webSource
            Set webSource = CreateObject("WebReportSource.WebReportSource")
            webSource.ReportSource = webBroker
            webSource.URL = Location.Protocol + "//" + Location.Host + "/sqlweb/rptserver.asp"
'            webSource.URL = Location.Protocol + "//" + Location.Host + "/scrreports/rptserver.asp"
            webSource.PromptOnRefresh = True
            CRViewer.ReportSource = webSource
      end if
      CRViewer.ViewReport
End Sub
-->
</SCRIPT>

</BODY>
</HTML>
I did have those include files and the output I showed was when using them, or at least one of them.

However, I've managed to accomplish what I was trying without using SQL.  I used a selection formula, which was a bit of a hassle at first, but it's all fine now.

If it's allowed, I can give you the points for your efforts, as I'm sure they would've worked if I continued to follow your suggestions.  Thanks for your help.
To be honest I have never used formula on such occassions... Well as long it works I wouldnt worry...
Rooesh Mohan,
Do you have the coding for SmartViewerJava.asp, SmartViwer HTMLFrame.asp and SmartViewHTMLPAge.asp? if you do, can i have them?