Solved

Passing recordset to crystal 8.5 from ASP shows grey control

Posted on 2004-08-12
47
655 Views
Last Modified: 2013-11-26
Hi

I have trouble showing up a report using the CRViewer in ASP. Im trying to assign the recordset to the CRViewer through ASP.

I downloaded the sample applciation for Seagate Crystal reports 8.5 from the following link

http://support.businessobjects.com/communityCS/FilesAndUpdates/aspxmps85.exe.asp

This zip file contains a folder called ADORecordsetExample. I created a System DSN named Xtreme Sample Database as instructed. But when I browse to the virtual directory created, all I see is the CRViewer ActiveX component. I do not see the report data. I just see the grey blank control

Response.Write oADORecordset.Fields(0) does work.

Please  help

Thanks
Vickram
0
Comment
Question by:VICKRAM
[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
  • 24
  • 21
47 Comments
 
LVL 13

Author Comment

by:VICKRAM
ID: 11790596
I am increasing the points
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 13

Author Comment

by:VICKRAM
ID: 11791060
Hi Tasneem

Thanks for your links. But I have put EXACTLY what contains in the sites pointed to by these links. I just see the activeX control spread across the page, I do not see any report. Its as though my file contains just the <OBJECT> tag and nothing else.

I need a clarification. What should the values of webSource.URL? Should it be "rptserver.asp" or the location of the rpt file?

The tek-tips link and the forums.aspfree.com link show it as:
webSource.URL = "ReportName.rpt?user0=UserName&password0=Password",

whereas the foum.devshed.com link show it as:
webSource.URL = "rptserver.asp" 'Location.Protocol + "//" + location.Host + "/scrsamples/Web Component Server/rptserver.asp"

Anyway, neither of those worked for me

Thanks
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11791099
try the following...Replace only the following piece of code as follows..

strHref=window.location.href
strval=split(strHref,"/",-1,1)
strWebPath=strval(2)& "/" & strval(3) & "/report.asp"
CRViewer.ReportName = location.protocol + "//" + strWebPath
the same applies to webSource.URL also

Get back if u face any problems

Basically someting like
webSource.URL = Location.Protocol + "//" + Location.Host  + "../project1/report.rpt"
or something more easy
webSource.URL = "http://<machinename>/scrreports/xtreme/hr.rpt"

anothre snippet
<%
Dim CRViewer1
Set CRViewer1 = Server.CreateObject("CrystalRuntime.CrystalReportViewer")
Dim WebBroker, WebSource
Set WebBroker = CreateObject("WebReportBroker.WebReportBroker")
Set WebSource = CreateObject("WebReportSource.WebReportSource")
WebSource.ReportSource = WebBroker
WebSource.URL = "http://hdq00c866/actualvsBudget/report1.rpt

CRViewer1.ReportSource = WebSource
CRWiewer1.ViewReport
%>
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11791277
Hi Tasneem

This is my code:
--------------------------------------------------------------------------------------------------------------------------
<HTML>
<HEAD>
<TITLE>Crystal Decisions ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 ONUNLOAD="CallDestroy();" topmargin=0 leftmargin=0>

<OBJECT ID="CRViewer"
      CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
      WIDTH=100% HEIGHT=99% RUNAT=SERVER
      CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217">
<PARAM NAME="EnableRefreshButton" VALUE=0>
<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 Window_Onload
      '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 = "rptserver.asp"
      else
            Dim webSource
            Set webSource = CreateObject("WebReportSource.WebReportSource")
            webSource.ReportSource = webBroker
            webSource.URL = "http://localhost/crystalADO/rptServer.asp"
            webSource.PromptOnRefresh = True            
            CRViewer.ReportSource = webSource
      end if
      CRViewer.ViewReport
End Sub
-->
</SCRIPT>

<script language="javascript">
function CallDestroy()
{
      window.open("Cleanup.asp","Cleanup","status=no,toolbar=no,location=no,menu=no,scrollbars=no,width=1,height=1");
        self.focus()
}
</script>
--------------------------------------------------------------------------------------------------------------------

Replacing webSource.URL = "http://localhost/crystalADO/rptServer.asp" with
webSource.URL = "http://localhost/crystalADO/ADORecordSetReport.rpt"

I tried placing your server-side code as well. Just a doubt, should I remove the OBJECT tag if I place the ASP code?

No progress.. :((

Again thanks for ur efforts
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11791563
Just a thought. Should I install something other than just Crystal Reports? May be something like Server side extensions? I see just this in the Start->Programs menu:

Crystal Report Tools -> Crystal Reports
                              -> Crystal Reports License

Thanks
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11791567
is it possible that the error is in your asp or the .rpt file .. we might be looking into wrong place.
Regards
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11791600
No way. The rpt file works fine from VB and I even tried doing a Response.write on the recordset and it showed the value. If I do a window.alert as shown in the VBScript block, I get a message box showinf [object]. This only goes to show that it is working, Right?

          Dim webSource
          Set webSource = CreateObject("WebReportSource.WebReportSource")
          webSource.ReportSource = webBroker
          webSource.URL = "http://localhost/crystalADO/rptServer.asp"
          webSource.PromptOnRefresh = True          
          window.alert (WebSource)           ------------------------- LIKE THIS
          CRViewer.ReportSource = webSource
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11791641
if it works from vb.. i dont think you require addtional components.. still doing RnD..
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11791704
Should I have Crystal Enterprise installed?
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11791933
Relax Vikram
http://www.mylocalgov.com/Marketing/smartvieweractivex.asp
go there .. this one atleast works.. so see the view source of this file.. modify yours accordingly.
I noticed one more thing. The first time i load the page.. it gives me an alert saying do i want to install the seagate crystal.. etc stuff.. If i say no I get a blank applet with a cross mark on it. Probably that could be your error... just check

Second time when i say yes.. it laods the entire applet with the data.
Following are some more links using the crystal ...
http://www.ntdors.com/ntdprod/parameterfield.asp?reportname=agency_contact_information.rpt
http://209.190.247.198/microbicide/Reports/FirstTime/GetViewerForReports.asp
check view source.. as its vbscript.. you can get the syntax..
My feeling is its more due to the reason that the client said no dont install the seagate cry..
Regards

0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11792253
My problem is that I cant browse to that link because im on a corporate network and my browser doent allow running activex content that come from external resources. May be you can send me the source u get through the View Source

Looks like I have to dump crystal :((.. my project deadline is nearing..
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11792291
well thats the problem i guess.. your browser does not allow running activex content

<HTML>
<HEAD>
<TITLE>Crystal Decisions ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 ONUNLOAD="CallDestroy();" 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="EnableRefreshButton" VALUE=0>
<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 Window_Onload
      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 = "rptserver.asp"
      else
            Dim webSource
            Set webSource = CreateObject("WebReportSource.WebReportSource")
            webSource.ReportSource = webBroker
            webSource.URL = "rptserver.asp"
            webSource.PromptOnRefresh = True
            CRViewer.ReportSource = webSource
      end if
      CRViewer.ViewReport
      'CRViewer.RefreshEx True
End Sub
-->
</SCRIPT>

<script language="javascript">
function CallDestroy()
{
      window.open("Cleanup.asp","Cleanup","status=no,toolbar=no,location=no,menu=no,scrollbars=no,width=1,height=1");
        self.focus()
}
</script>

</BODY>
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11792333
Check this
in your Internet explorer ->General->Settings->View Objects
check if you have Crystal Report Viewer Control present.
If its not there.. then there lies your problem. Check and let me know.. i would be leaving for the day in sometime..
IF you are not allowed to download from an external site..your code base is pointnig to local one.. atleast your IE should allow from the local ie ="/viewer/activeXViewer/activexviewer.cab

Also from your code.. remove the version part of it.
Regards
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11792453
I dont see it there..
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11792517
Well thats where the problem is.
Find /viewer/activeXViewer/activexviewer.cab file put it in proper place.
When you load your browser you should get an alert stating if you wish to install the Seagate Crystal Viewer..
There is no problem in your coding. COde is perfectly fine. Your problem is the location of the .cab file
Regards
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11792527
i wont be loggin in during the weekend.. place the .cab file in the proper location. ALl the best
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11792559
Well I have created a virtual directory named /viewer under the same application and pointed in to this folder-C:\Program Files\Seagate Software\Viewers, so that /viewer/activeXViewer/activexviewer.cab is a valid one

But still I do not get it
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11792575
1. what happens when you say http://localhost/viewer/activeXViewer/activexviewer.cab does it ask you to download and install something?
2.Can you paste your page url and
3. -C:\Program Files\Seagate Software\Viewers\activeXviewer\ folder have that .cab file in it
Regards
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11792602
1. I am asked to download and save the .cab file
2. This is the page url- http://localhost/crystalADO/ADORecordSet.asp
3. This is the url- http://localhost/viewer/ActiveXViewer/activexviewer.cab
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11792619
good.. did you say yes. if not say yes.. and try to load the page.. it should work... all the best
Regards
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11817464
is your issue resolved after download and run .cab file?
Regards
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11819032
Hi

No its not. Just like I said, I am presented with a download box asking me to save the .cab file
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11819086
Call the asp page.. put your cursor on the toolbar to see if there is a wait icon comming in. If so then wait patiently. Later on it should ask you Do you want to install and run "Crystal Smart Viewer for Activex". At this point you need to say yes.

If it does not work why not call your url from some other machine.
Regards
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11819100
http://www.ntdors.com/ntdprod/parameterfield.asp?reportname=agency_contact_information.rpt
http://209.190.247.198/microbicide/Reports/FirstTime/GetViewerForReports.asp
http://www.mylocalgov.com/Marketing/smartvieweractivex.asp
The above 3 links.. all of them uses "Crystal Smart Viewer" So the first time you load either of them.. it will give you that alert saying do you want to install and run the active x.. its signed.. so you can say yes. Past which you will be able to view not only the other 2 sites without a grey cell.. but you would be albe to see your own.
Regards
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11819355
Just like I said earlier, I cannot view them because accessing ActiveX content is restricted in my corporate network.
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11819372
well the problem lies that your IE should ahve in the objects installed that particular activex. If you can do that from your local system it should sort out the issue. Perhaps try asking your local admin to let install it from your local system that particular cab file.. ie activex
REgards
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11819459
ok I will ask and see it they allow me
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11849099
Hi Tasneem

I checked your URLs from my home pc. And yes it did ask me for installing the activeX component. Looks like now I will have to ask my system administrator to give me permissions to allow me to download/install the activeX component. I will get back to you soon..

Thanks
Vickram
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11889027
Just hang on. I will let you how things are at the end of the week. I just hope they work on my corporate network

Thanks
Vickram Ganesh
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11904281
Hi

I tried but for some reason its not working on the corporate network. Is there any other way to do it ? I have heard it can be published using Crystal Enterprise.

Thanks
Vickram Ganesh
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11919780
Can you help me findout how to pass parameters to crystal reports that is published in a crystal enterprise? Again I want to do this is ASP

0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11925571
http://support.businessobjects.com/library/kbase/articles/c2007895.asp
Sometimes you might face errors as in this http://www.experts-exchange.com/Databases/Crystal_Reports/Q_20980230.html Solution is also provided there.
Crystal Reports Online Tech Support:
http://support.businessobjects.com/search/advsearch.asp

Crystal Reports Forum:
http://support.businessobjects.com/forums/default.asp

In your vb project, you need to add a Crystal reports control and the Crystal viewer control(if you are going to have the user view the report).
http://support.businessobjects.com/communityCS/FilesAndUpdates/scr_vb_ocx_parameter.exe.asp
is for passing parameter.

Regards
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11928804
I get a memory full error while trying to add a oracle stored procedure to crystal report. I am using Oracle 9i. Is there any specific driver I must connect through?
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11938956
The document didnt help.. but when I created a DSN and referred that in CR it worked.. Coming back to the original question on CR enterprise. Can you tell me how to pass parameters to a RPT file that is published in CR Enterprise and show it in a web page. I want to do this in ASP.. The links you provided use the ActiveX component that comes with only 5 free licenses. This is not used in our corporate. This is the very reason we are using Crystal Enterprise. The other link using VB used the CR Viewer which again is the activeX component. I have heard something about SessionMgr, InfoStore and things like that but dont know how to use them in ASP. a google search didnt help much..

A code sample would do fine

Thanks

0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11960126
I have been missing the point till now. The web server where i have my asp files is different from the server which is hosting crystal enterprise.
Now i have 2 questions:
1. how do i show a report published in the CE in my web site. I need to pass parameters to the report which in turn gets its data from a stored proc
2. how do i maintain session across this web farm. I know asp.net makes session management easier in a web farm. But I am using classoc asp.

I cannot afford to pass the parameters in the url due to security issues.

Thanks
Vickram
0
 
LVL 4

Expert Comment

by:Tasneem
ID: 11960473
well this one has the soln to grey control..
https://css.engineering.uiowa.edu/coewebs/CrystalEnterprise/Documents/Help.htm
still searching for the parameter hiding.. and multiple servers.. bascially multiple servers should not be an issue
0
 
LVL 13

Author Comment

by:VICKRAM
ID: 11995347
Hi Tasneem

I solved the issue with Crystal enterprise. The web-farm issue was resolved by passing the parameters as hidden fields and performing a POST to the viewrpt.cwr file. Here is the FORM code

iReportID is the ID of the report as it exist in the Crystal Enterprise repository
APSToken is the token created using the LogonTokenMgr.CreateLogonTokenEx() method

<body>
      <form name="report" action="viewrpt.cwr?id=<%=iReportID%>&APSToken=<%=Server.URLEncode(Request.Cookies("LogonToken"))%>&init=actx" method="post">
            <input type="submit" value="submit">            
            <input type="text" name="promptex-P_PSID" value="10031526">
            <input type="text" name="promptex-P_BONUSYEAR" value="2003">
            <input type="text" name="promptex-P_PY" value="2002">
            <input type="text" name="promptex-P_PY2" value="2001">
            <input type="text" name="promptex-P_PY3" value="2000">
            <input type="text" name="promptex-P_DIVISIONID" value="1">
            <input type="text" name="promptex-P_SNAPSHOTID" value="390">
            <input type="text" name="promptex-P_ASOF" value="Current">
            <input type="text" name="promptex-P_VIEWAS" value="John">
            <input type="text" name="promptex-P_CB1" value="CB1">
            <input type="text" name="promptex-P_CB2" value="CB2">
            <input type="text" name="promptex-P_CB3" value="CB3">
            <input type="text" name="promptex-P_CB4" value="CB4">
            <input type="text" name="promptex-P_CB5" value="CB5">
            <input type="text" name="promptex-P_CB6" value="CB6">
            <input type="text" name="promptex-P_CB7" value="CB7">
            <input type="text" name="promptex-P_CB8" value="CB8">
            <input type="text" name="promptex-P_CB9" value="CB9">
            <input type="text" name="promptex-P_CB10" value="CB10">
            <input type="text" name="promptex-P_CB11" value="CB11">
            <input type="text" name="promptex-P_CB12" value="CB12">
            
            <INPUT TYPE="Hidden" NAME="parameter_prompt" VALUE="0">
            <INPUT TYPE="Hidden" NAME="viewer" VALUE="actx">
            <INPUT TYPE="Hidden" NAME="promptonrefresh" VALUE="0">
      </form>      
</body>

The key is to prefix the parameter name with 'promptex-' , otherwise crystal prompts for the parameters. I hope you understood the rest of the code which I have not given here(Its about how to logon to the APS)

Thanks
Vickram Ganesh
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12267994
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

624 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