473,657 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parameter ignored for ExportToStream ASP.NET

Hello All

I am having a very hard timt exporting crystal report to PDF document
in my ASPX page. I am able to generate the PDF document , but the i
am not able to pass the parameter to the report (Crystal). It looks
like , it completely ignores the parameter i am passing and just
brings all the records from the database.
When i run the report directly from Crystal , it works fine. So I
know report works fine . For some strange reason , the parameter i
am passing are not applied to the report.
Can anyone share your ideas of how to do this !!!.. Thank you

Here is the code

Dim SActivityID As Long = 0
Dim iAppUserId As Long = 0
Dim myReport As ReportDocument = New ReportDocument
Dim s As Stream
Dim crConnectionInf o As CrystalDecision s.Shared.Connec tionInfo
Dim pDv As ParameterDiscre teValue = New ParameterDiscre teValue
Dim crTable As CrystalDecision s.CrystalReport s.Engine.Table
Dim crTables As CrystalDecision s.CrystalReport s.Engine.Tables
Dim crTableLogOnInf o As CrystalDecision s.Shared.TableL ogOnInfo
Dim crDatabase As
CrystalDecision s.CrystalReport s.Engine.Databa se
Dim parameterFieldD ef As ParameterFieldD efinition
Dim parameterValues As ParameterValues
Dim ExpOptions As ExportOptions
Dim req As ExportRequestCo ntext
iAppUserId = CLng(Session("S SXYUser_ID"))
If Not IsPostBack Then
If iAppUserId <= 0 Then
Response.Redire ct("Login.aspx" )
Response.ClearH eaders()
Else

crConnectionInf o = New
CrystalDecision s.Shared.Connec tionInfo
crConnectionInf o.ServerName = "XXXXXX"
crConnectionInf o.DatabaseName = "YYYYYYYYYY Y"
crConnectionInf o.UserID = "NO"
crConnectionInf o.Password = "VVVVVVVV"

myReport.Load(" c:\\inetpub\\ww wroot\\XZY\\Spe cimenReport.rpt ")
crDatabase = myReport.Databa se
crTables = crDatabase.Tabl es

For Each crTable In crTables
crTableLogOnInf o = crTable.LogOnIn fo
crTableLogOnInf o.ConnectionInf o = crConnectionInf o
crTable.ApplyLo gOnInfo(crTable LogOnInfo)
Next

SActivityID = CLng(Request.Pa rams("SpecimenA ctID"))
Response.ClearH eaders()
Response.ClearC ontent()
Response.Conten tType = "applicatio n/pdf"
pDv.Value = SActivityID

parameterFieldD ef =
myReport.DataDe finition.Parame terFields("Spec imenActId")
parameterValues = parameterFieldD ef.CurrentValue s
parameterValues .Add(pDv)
parameterFieldD ef.ApplyCurrent Values(paramete rValues)

req = New ExportRequestCo ntext
ExpOptions = New ExportOptions
ExpOptions.Expo rtFormatType =
ExportFormatTyp e.PortableDocFo rmat
ExpOptions.Form atOptions = New PdfRtfWordForma tOptions

req.ExportInfo = ExpOptions

s = myReport.Format Engine.ExportTo Stream(req)
Response.ClearH eaders()
Response.ClearC ontent()
Response.Conten tType = "applicatio n/pdf"

Dim buffer(s.Length ) As Byte
s.Read(buffer, 0, Int(s.Length))
Response.Binary Write(buffer)
Response.End()
End If
Nov 18 '05 #1
1 1517
Radx,

In your Crystal report Designer, you need to copy the formula Filter
From (Report >> Edit Selection Formula >> Record... )
TO (Report >> Edit Selection Formula >> Group...)

Haitham Aldaqqaq
Medcor, Inc.
ra*****@hotmail .com (Radx) wrote in message news:<d9******* *************** ****@posting.go ogle.com>...
Hello All

I am having a very hard timt exporting crystal report to PDF document
in my ASPX page. I am able to generate the PDF document , but the i
am not able to pass the parameter to the report (Crystal). It looks
like , it completely ignores the parameter i am passing and just
brings all the records from the database.
When i run the report directly from Crystal , it works fine. So I
know report works fine . For some strange reason , the parameter i
am passing are not applied to the report.
Can anyone share your ideas of how to do this !!!.. Thank you

Here is the code

Dim SActivityID As Long = 0
Dim iAppUserId As Long = 0
Dim myReport As ReportDocument = New ReportDocument
Dim s As Stream
Dim crConnectionInf o As CrystalDecision s.Shared.Connec tionInfo
Dim pDv As ParameterDiscre teValue = New ParameterDiscre teValue
Dim crTable As CrystalDecision s.CrystalReport s.Engine.Table
Dim crTables As CrystalDecision s.CrystalReport s.Engine.Tables
Dim crTableLogOnInf o As CrystalDecision s.Shared.TableL ogOnInfo
Dim crDatabase As
CrystalDecision s.CrystalReport s.Engine.Databa se
Dim parameterFieldD ef As ParameterFieldD efinition
Dim parameterValues As ParameterValues
Dim ExpOptions As ExportOptions
Dim req As ExportRequestCo ntext
iAppUserId = CLng(Session("S SXYUser_ID"))
If Not IsPostBack Then
If iAppUserId <= 0 Then
Response.Redire ct("Login.aspx" )
Response.ClearH eaders()
Else

crConnectionInf o = New
CrystalDecision s.Shared.Connec tionInfo
crConnectionInf o.ServerName = "XXXXXX"
crConnectionInf o.DatabaseName = "YYYYYYYYYY Y"
crConnectionInf o.UserID = "NO"
crConnectionInf o.Password = "VVVVVVVV"

myReport.Load(" c:\\inetpub\\ww wroot\\XZY\\Spe cimenReport.rpt ")
crDatabase = myReport.Databa se
crTables = crDatabase.Tabl es

For Each crTable In crTables
crTableLogOnInf o = crTable.LogOnIn fo
crTableLogOnInf o.ConnectionInf o = crConnectionInf o
crTable.ApplyLo gOnInfo(crTable LogOnInfo)
Next

SActivityID = CLng(Request.Pa rams("SpecimenA ctID"))
Response.ClearH eaders()
Response.ClearC ontent()
Response.Conten tType = "applicatio n/pdf"
pDv.Value = SActivityID

parameterFieldD ef =
myReport.DataDe finition.Parame terFields("Spec imenActId")
parameterValues = parameterFieldD ef.CurrentValue s
parameterValues .Add(pDv)
parameterFieldD ef.ApplyCurrent Values(paramete rValues)

req = New ExportRequestCo ntext
ExpOptions = New ExportOptions
ExpOptions.Expo rtFormatType =
ExportFormatTyp e.PortableDocFo rmat
ExpOptions.Form atOptions = New PdfRtfWordForma tOptions

req.ExportInfo = ExpOptions

s = myReport.Format Engine.ExportTo Stream(req)
Response.ClearH eaders()
Response.ClearC ontent()
Response.Conten tType = "applicatio n/pdf"

Dim buffer(s.Length ) As Byte
s.Read(buffer, 0, Int(s.Length))
Response.Binary Write(buffer)
Response.End()
End If

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1901
by: Radx | last post by:
Hello All I am having a very hard timt exporting crystal report to PDF document in my ASPX page. I am able to generate the PDF document , but the i am not able to pass the parameter to the report (Crystal). It looks like , it completely ignores the parameter i am passing and just brings all the records from the database. When i run the report directly from Crystal , it works fine. So I know report works fine . For some strange...
0
1014
by: Radx | last post by:
Hello All I am having a very hard timt exporting crystal report to PDF document in my ASPX page. I am able to generate the PDF document , but the i am not able to pass the parameter to the report (Crystal). It looks like , it completely ignores the parameter i am passing and just brings all the records from the database. When i run the report directly from Crystal , it works fine. So I know report works fine . For some strange...
1
373
by: Radx | last post by:
Hello All I am having a very hard timt exporting crystal report to PDF document in my ASPX page. I am able to generate the PDF document , but the i am not able to pass the parameter to the report (Crystal). It looks like , it completely ignores the parameter i am passing and just brings all the records from the database. When i run the report directly from Crystal , it works fine. So I know report works fine . For some strange...
0
1802
by: lrobo01 | last post by:
I'm having a problem with Crystal report.net with ASP.NET. The problem occurs when exporting the report. The report uses a discrete parameter with multiple values. When the report is loaded into the crystal report view it shows all the values from the discrete parameter. But when I export the report it only shows the values from the last discrete parameter value enter. My code is listed below:
0
8421
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8325
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.