473,799 Members | 2,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Crytal Reports...Expor t Error with parms

Hey all,

I am trying to try get a crytal report running properly. A "Hello World"
report that does not add criteria to the record selection formula of the
report (either in the development tool, or in the code) works fine.

However, when I try to add any parameter through the record selection
formula and/or the report parameters method, the report crashes.

I have tried each of the methods:

1. Use the Record Selection Formula property:

crReportDocumen t.DataDefinitio n.RecordSelecti onFormula = "{qryTest.I D} =
54"

2. Use the Crystal Parameters collection(s)

crParameterFiel dDefinitions =
crReportDocumen t.DataDefinitio n.ParameterFiel ds

crParameterFiel dDefinition = crParameterFiel dDefinitions.It em("[@TestID]")
crParameterValu es = crParameterFiel dDefinition.Cur rentValues
crParameterDisc reteValue = New
CrystalDecision s.Shared.Parame terDiscreteValu e()

crParameterDisc reteValue.Value = 54
crParameterValu es.Add(crParame terDiscreteValu e)
crParameterFiel dDefinition.App lyCurrentValues (crParameterVal ues)
Both of the methods above work fine on my development machine but the
testing server gives these errors.

I also set the record selection formula in the report to automatically set
the TestID parameter = 54 and then tested that report on the testing server
and everything worked.

So the issue seems to be with populating the crystal report's parameters at
runtime. The error that comes back with a logon failure at the .Export
line.

I have tried two methods to logon to the reports:
############### #####
Basic:
With tliTableLogonIn fo.ConnectionIn fo
.ServerName = m_strDSNName
.DatabaseName = m_strDatabase
.UserID = m_strUserId
.Password = m_strPassword
End With

'setup each connection in the report
For Each tTable In crReportDocumen t.Database.Tabl es
tTable.ApplyLog OnInfo(tliTable LogonInfo)
Next tTable
############### #####
and Complex (loops through sub-reports):
Dim mySection As Section
Dim mySections As Sections
Dim myReportObject As ReportObject
Dim myReportObjects As ReportObjects
Dim mySubReportObje ct As SubreportObject
Dim mySubRepDoc As New ReportDocument( )

'Declare all of the sections of the main report
mySections = crReportDocumen t.ReportDefinit ion.Sections

'Loop through the sections in the main report to find the subreport objects
'then set the logon information to the subreport
Dim myLogin As CrystalDecision s.Shared.TableL ogOnInfo

For Each mySection In mySections
myReportObjects = mySection.Repor tObjects

For Each myReportObject In myReportObjects
If myReportObject. Kind = ReportObjectKin d.SubreportObje ct Then
'Subreport Found - convert the report object to a sub report type
mySubReportObje ct = CType(myReportO bject, SubreportObject )
'Set the specific instance of this subreport
mySubRepDoc = mySubReportObje ct.OpenSubrepor t
(mySubReportObj ect.SubreportNa me)

'Set the login information for the current subreport(found )
For Each crTable In mySubRepDoc.Dat abase.Tables
myLogin = crTable.LogOnIn fo
myLogin.Connect ionInfo.ServerN ame = m_strDSNName
myLogin.Connect ionInfo.Databas eName = m_strDatabase
myLogin.Connect ionInfo.UserID = m_strUserId
myLogin.Connect ionInfo.Passwor d = m_strPassword
crTable.ApplyLo gOnInfo(myLogin )
Next
End If
Next
Next
############### #####
Does anyone know of other methods to filter a report at runtime? Or is
there a Crystal DLL that I need to move from my dev machine to the server
to allow for the record selection properties to be set at runtime?

OR ANY OTHER INFO WOULD BE GREAT!!!

Thanks,

TJ
Nov 18 '05 #1
1 1683
This is working code... In the report design, the parameter name is @pBDate
and is a DateTime type. In the Select Expert, I use.... is equal to and
the value is {?@pBDate} which takes the passed parameter to the cr query
renderer.

If you encounter login problems, let me know - I have some gotcha's that
remedy that.
Imports CrystalDecision s.CrystalReport s.Engine
Imports CrystalDecision s.Shared

'public class....
'inherits....

'Web Form Designer....

Dim cdoc As ReportDocument

Private Sub Page_Load...

'load cr object...
cdoc = New CrystalReport1

'...or you can also do this...
'crDoc.Load("C: \reports\Crysta lReport1.rpt")

Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInf o As TableLogOnInfo
Dim crConnectionInf o As ConnectionInfo

crConnectionInf o = New ConnectionInfo
With crConnectionInf o
.ServerName = "sqlServer"
.DatabaseName = "sqlDatabas e"
.UserID = "sqlLogin"
.Password = "password"
End With

crDatabase = cdoc.Database
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

Dim crPFDs As ParameterFieldD efinitions
Dim crPFD As ParameterFieldD efinition

Dim crParameterValu es As New ParameterValues
Dim crPBdate As New ParameterDiscre teValue

crPFDs = cdoc.DataDefini tion.ParameterF ields
crPBdate.Value = "11/28/03"
crPFD = crPFDs.Item("@p BDate")
crParameterValu es = crPFD.CurrentVa lues
crParameterValu es.Add(crPBdate )
crPFD.ApplyCurr entValues(crPar ameterValues)

Me.CrystalRepor tViewer1.Report Source = cdoc

End Sub

--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz

"Tim Jones" <ti**********@y ahoo.ca> wrote in message
news:Xn******** *************** **********@24.7 0.95.211...
Hey all,

I am trying to try get a crytal report running properly. A "Hello World"
report that does not add criteria to the record selection formula of the
report (either in the development tool, or in the code) works fine.

However, when I try to add any parameter through the record selection
formula and/or the report parameters method, the report crashes.

I have tried each of the methods:

1. Use the Record Selection Formula property:

crReportDocumen t.DataDefinitio n.RecordSelecti onFormula = "{qryTest.I D} =
54"

2. Use the Crystal Parameters collection(s)

crParameterFiel dDefinitions =
crReportDocumen t.DataDefinitio n.ParameterFiel ds

crParameterFiel dDefinition = crParameterFiel dDefinitions.It em("[@TestID]")
crParameterValu es = crParameterFiel dDefinition.Cur rentValues
crParameterDisc reteValue = New
CrystalDecision s.Shared.Parame terDiscreteValu e()

crParameterDisc reteValue.Value = 54
crParameterValu es.Add(crParame terDiscreteValu e)
crParameterFiel dDefinition.App lyCurrentValues (crParameterVal ues)
Both of the methods above work fine on my development machine but the
testing server gives these errors.

I also set the record selection formula in the report to automatically set
the TestID parameter = 54 and then tested that report on the testing server and everything worked.

So the issue seems to be with populating the crystal report's parameters at runtime. The error that comes back with a logon failure at the .Export
line.

I have tried two methods to logon to the reports:
############### #####
Basic:
With tliTableLogonIn fo.ConnectionIn fo
.ServerName = m_strDSNName
.DatabaseName = m_strDatabase
.UserID = m_strUserId
.Password = m_strPassword
End With

'setup each connection in the report
For Each tTable In crReportDocumen t.Database.Tabl es
tTable.ApplyLog OnInfo(tliTable LogonInfo)
Next tTable
############### #####
and Complex (loops through sub-reports):
Dim mySection As Section
Dim mySections As Sections
Dim myReportObject As ReportObject
Dim myReportObjects As ReportObjects
Dim mySubReportObje ct As SubreportObject
Dim mySubRepDoc As New ReportDocument( )

'Declare all of the sections of the main report
mySections = crReportDocumen t.ReportDefinit ion.Sections

'Loop through the sections in the main report to find the subreport objects 'then set the logon information to the subreport
Dim myLogin As CrystalDecision s.Shared.TableL ogOnInfo

For Each mySection In mySections
myReportObjects = mySection.Repor tObjects

For Each myReportObject In myReportObjects
If myReportObject. Kind = ReportObjectKin d.SubreportObje ct Then
'Subreport Found - convert the report object to a sub report type
mySubReportObje ct = CType(myReportO bject, SubreportObject )
'Set the specific instance of this subreport
mySubRepDoc = mySubReportObje ct.OpenSubrepor t
(mySubReportObj ect.SubreportNa me)

'Set the login information for the current subreport(found )
For Each crTable In mySubRepDoc.Dat abase.Tables
myLogin = crTable.LogOnIn fo
myLogin.Connect ionInfo.ServerN ame = m_strDSNName
myLogin.Connect ionInfo.Databas eName = m_strDatabase myLogin.Connect ionInfo.UserID = m_strUserId
myLogin.Connect ionInfo.Passwor d = m_strPassword
crTable.ApplyLo gOnInfo(myLogin )
Next
End If
Next
Next
############### #####
Does anyone know of other methods to filter a report at runtime? Or is
there a Crystal DLL that I need to move from my dev machine to the server
to allow for the record selection properties to be set at runtime?

OR ANY OTHER INFO WOULD BE GREAT!!!

Thanks,

TJ

Nov 18 '05 #2

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

Similar topics

7
8874
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
8
20378
by: An Ony | last post by:
Hello, I'm trying to write a program (dll) to use with mIRC. mIRC wants me to use these kind of functions: int __stdcall procname(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause) translated into C# code, I think it's this:
3
2827
by: Russ | last post by:
I have a page that uses crystal reports to generate reports from a SQl server database. As of a week ago everything was working fine, but now I am all of the sudden getting errors. To the best of my knowledge nothing was changed on the server. Here is the error: Error in File C:\DOCUME~1\WEBSERVER\ASPNET\Local Settings\Temp\temp_57908cf8-dba0-4327-b785-95de5cf6e523.rpt: Invalid export DLL or export format.
2
2558
by: GFro | last post by:
I am getting the following error since we upgraded from .NET Framework 1.0 to 1.1. The reports all ran fine yesterday. I get this error in all apps with reports. The apps run fine but the reports give me the login error. Any ideas?
1
3562
by: Hardy Wang | last post by:
Hi all, I have a piece of code in my C# console application to export from crystal report files to PDF. For some reports files, I get errors below. I have Crystal Reports 8.5 with service pack installed on my local machine. What is the reason to cause this "Unknown Query Engine Error"? This is a report with 3 sub-reports, is there anything missing in my code to handle this type of reports? Thanks a lot! =====================Error Call...
3
13381
by: Peter | last post by:
VS 2005 Pro. I am getting the following error when I try to export a report to PDF or any other format using Crystal Reports 11 library. Does anyone knows how to fix this problem, the same code work fine in .NET 1.1 I have search for this error in Google and BusinessObjects website but have not found anything. Here's the error message: {"Method 'ISCREditableRTFExportFormatOptions_reserved5' on type...
2
9890
by: =?Utf-8?B?Um9iZXJ0?= | last post by:
About the time we installed Windows Server 2003 SP2 on our Web servers, our exports to Excel stopped working from Crystal Reports .NET within all our ASP.NET applications. However, the exports to pdf and Word still work. Is anyone else having this problem and have you found a resolution? We are using ..NET Framework 1.1. The web apps were created in Visual Studio 2003.
3
2365
by: manjitsarma | last post by:
I am getting following Exception in opening crystal report in an ASP.NET application. WebReport Control error:System Exception:Load Report failed. Once crytal reports are opened one by one,the exception arises within 15-20 mints .From then onwards I am not able to open the reports.If IIS is restarted ,I am able to open the reports.But again the exception arises after 15-20 mints. Can anyone plz help me.its very urgent.... Regards
3
4363
by: evenlater | last post by:
I have an Access application on a terminal server. Sometimes my users need to export reports to pdf, rtf or xls files and save them to their own client device hard drives. They can do that right now the way I have this set up, but it's confusing and slow. When they browse for a place to save the reports, they see all of the drives on the terminal server as well as their own client drives. So they're likely to want to choose "My...
0
9686
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
9540
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
10475
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...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10026
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...
1
7564
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...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.