473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

parameter ignored for ExportToStream .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 crConnectionInfo As CrystalDecisions.Shared.ConnectionInfo
Dim pDv As ParameterDiscreteValue = New ParameterDiscreteValue
Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
Dim crTableLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim crDatabase As
CrystalDecisions.CrystalReports.Engine.Database
Dim parameterFieldDef As ParameterFieldDefinition
Dim parameterValues As ParameterValues
Dim ExpOptions As ExportOptions
Dim req As ExportRequestContext
iAppUserId = CLng(Session("SSXYUser_ID"))
If Not IsPostBack Then
If iAppUserId <= 0 Then
Response.Redirect("Login.aspx")
Response.ClearHeaders()
Else

crConnectionInfo = New
CrystalDecisions.Shared.ConnectionInfo
crConnectionInfo.ServerName = "XXXXXX"
crConnectionInfo.DatabaseName = "YYYYYYYYYYY"
crConnectionInfo.UserID = "NO"
crConnectionInfo.Password = "VVVVVVVV"

myReport.Load("c:\\inetpub\\wwwroot\\XZY\\Specimen Report.rpt")
crDatabase = myReport.Database
crTables = crDatabase.Tables

For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next

SActivityID = CLng(Request.Params("SpecimenActID"))
Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/pdf"
pDv.Value = SActivityID

parameterFieldDef =
myReport.DataDefinition.ParameterFields("SpecimenA ctId")
parameterValues = parameterFieldDef.CurrentValues
parameterValues.Add(pDv)
parameterFieldDef.ApplyCurrentValues(parameterValu es)

req = New ExportRequestContext
ExpOptions = New ExportOptions
ExpOptions.ExportFormatType =
ExportFormatType.PortableDocFormat
ExpOptions.FormatOptions = New PdfRtfWordFormatOptions

req.ExportInfo = ExpOptions

s = myReport.FormatEngine.ExportToStream(req)
Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/pdf"

Dim buffer(s.Length) As Byte
s.Read(buffer, 0, Int(s.Length))
Response.BinaryWrite(buffer)
Response.End()
End If
Nov 20 '05 #1
0 1006

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

Similar topics

1
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...
0
by: baumann | last post by:
hi all, Nontype template parameters are declared much like variables, but they cannot have nontype specifiers like static, mutable, and so forth. They can have const and volatile qualifiers,...
4
by: Michael C | last post by:
I was looking over some code that calls a stored procedure from C#. I have specified one more parameter than necessary but the code still works. Does anyone know why it works? This is on a PDA...
0
by: ashok.ponnusamy | last post by:
hi, i was created crystal report in my aspx. it's work fine. but i want to change the parameter value by selecting value from dropdownlist in the aspx page. First time it's work fine.second time...
5
by: Roy Smith | last post by:
I've got some legacy code I'm maintaining. There's a method declared in the class.h file like this: void foo(unsigned priority); and it's implemented as: void myClass::foo (unsigned /*...
1
by: gglegrp112 | last post by:
Is it possible to send an array as a parameter for an execute method in dbapi2 module? I'm using adodbapi and try to perfrom the following SQL query: select * from item where storeid in ('01',...
0
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...
0
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...
1
by: harikrish | last post by:
HI im facing a problem that when i export my crystal reports to pdf format using ReportDocument object's ExportToStream method, it led me the error message that Method...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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,...

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.