Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2003, 05:28 PM
Registered User
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL, ASP and Crystal Reports

I have a report in Crystal that I need to let users view/print via the web. The report is based on a view in SQL that will remain constant. However, I need the report to be populated with a subset of that view based on user information. I've read the technical articles on Crystal's website about creating a TTX file...that's fine, but I don't need to create a new report...I want to use the one I've already created. I can generate a sql query string with the user information through asp. But I can't figure out how to get it to the report. I'm using the following code to access the viewer. I'm not (and prefer not to have to) access the RDC. My users don't need to be able to create a report...just view the report we've created populated with their subset of the data. Thanks!

<html>
<head>
<TITLE>Region 7</TITLE>
</head>
<SCRIPT LANGUAGE="JavaScript">
</SCRIPT>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript topmargin=0 leftmargin=0>
<OBJECT ID="CRViewer"
    CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
    WIDTH=100% HEIGHT=99%
    CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
<PARAM NAME="EnableSearchExpertButton" VALUE=0>
<PARAM NAME="EnableSelectExpertButton" VALUE=0>
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
<!--

Sub window_onLoad()
    Page_Initialize()
End Sub
Sub Page_Initialize
    On Error Resume Next
    Dim webBroker
    Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
    if err.number <> 0 then
        window.alert "The Crystal ActiveX Viewer is unable to create it's resource objects."
        CRViewer.ReportName = "/Compass/TAKSTracker/TAKSReport2.rpt"
    else
        Dim webSource0
        Set webSource0 = CreateObject("WebReportSource.WebReportSource")
        webSource0.ReportSource = webBroker
        webSource0.URL = "/Compass/TAKSTracker/TAKSReport2.rpt"
        webSource0.PromptOnRefresh = True
        CRViewer.ReportSource = webSource0
        CRViewer
    end if
    CRViewer.ViewReport
End Sub

-->
</SCRIPT>
<OBJECT ID="ReportSource"
    CLASSID="CLSID:F2CA2115-C8D2-11D1-BEBD-00A0C95A6A5C"
    HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
</OBJECT>
<OBJECT ID="ViewHelp"
    CLASSID="CLSID:BD10A9C1-07CC-11D2-BEFF-00A0C95A6A5C"
    HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
</OBJECT>
<OBJECT ID="ReportParameter"
    CLASSID="CLSID:71C140F3-1A84-430b-9035-68815582DC79"
    HEIGHT=1% WIDTH=1%
    CODEBASE="/viewer/activeXViewer/reportparameterdialog.cab#Version=8,0,2,672">
</OBJECT>
</body>
</html>
 
Old June 13th, 2003, 03:54 AM
Registered User
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

Have you looked at the ASPXMPS8 and ASPXMPS85 samples on the Crystal website.

I picked up quite a bit from them

I use the session variables in the activex viewer like so.

Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")
Set session("oRpt") = session("oApp").OpenReport(reportname, 1)
Session("oRpt").RecordSelectionFormula = strFilter

Set strFilter to a valid SQL select.

Hope that helps





Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Reports 8.5 with SQL 2000 jroxit SQL Server 2000 2 March 20th, 2015 01:39 AM
ASP.NET 1.1,VB.NET,crystal reports, SQl server gvi Crystal Reports 1 September 11th, 2008 02:55 AM
Crystal Reports 8.0 , My Sql 5.0 with Vb6.0 thiyagu6682 Pro VB Databases 0 August 21st, 2007 08:22 AM
SQL in Crystal Reports Roopedog Crystal Reports 1 August 9th, 2005 07:18 AM
Need to connect SQL database to Crystal Reports vbmazza Crystal Reports 0 May 13th, 2005 06:24 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.