473,772 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about data filtering in Crystal Report

Ray
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray
Nov 21 '05 #1
6 5188
Hi Ray,

Can we see some code?

Bernie Yaeger

"Ray" <so*****@micros oft.com> wrote in message
news:ud******** ******@TK2MSFTN GP11.phx.gbl...
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to
the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I
set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray

Nov 21 '05 #2
Ray
Dear Bernie,
Here is the code.

## Code for define the Report Document
Dim ReportDoc As New ReportDocument
Dim pfieldname As String = "abc"
Dim StrReport As String = ""
StrReport = "E:\test.rp t"
ReportDoc.Load( StrReport)
For Each table In ReportDoc.Datab ase.Tables
logoninfo = table.LogOnInfo
With logoninfo.Conne ctionInfo
.ServerName = "SERVER"
.DatabaseName = "Sea"
.UserID = "admin"
.Password = "abcd3"
End With
table.ApplyLogO nInfo(logoninfo )
Next table
ReportDoc.Recor dSelectionFormu la = "{TableName.fie ldname} = """ &
pfieldname & """"
Dim Form As New frmPrintForm(te mp, ReportDoc, blnPrintsw)
Form.Show()
############### ############### #####

I have created another form and put the crystalreportvi ewer on it. I pass
the ReportDocument defined by the code above to this form and the code is
Me.CRViewer.Rep ortSource = ReportDoc

Thanks a lot,
Ray

"Bernie Yaeger" <be*****@cherwe llinc.com> ¦b¶l¥ó
news:uM******** *****@TK2MSFTNG P12.phx.gbl ¤¤¼¶¼g...
Hi Ray,

Can we see some code?

Bernie Yaeger

"Ray" <so*****@micros oft.com> wrote in message
news:ud******** ******@TK2MSFTN GP11.phx.gbl...
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to
the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I
set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray


Nov 21 '05 #3
Hi Ray,

OK, looked at the code. When you call the report the second time, what is
the value of pfieldname and what code calls the report? It must be
different code, because if you called this code again, pfieldname would have
to be the same (ie, abc).

Bernie

"Ray" <so*****@micros oft.com> wrote in message
news:ud******** ******@TK2MSFTN GP11.phx.gbl...
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to
the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I
set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray

Nov 21 '05 #4
Ray
Dear Bernie,
I use the text box to input the data name should be filtered and then
pass to the ReportDocument.
So I use the same code in the second time also. For the first time, I
call the report by input a data name to the text box while running the
program, then I close the report, then I input another data name to the text
box and call the report again. For this time, the necessary data cannot be
filtered out.
It seems that the report's data has been filtered to the data in the first
time, and since the data in the second time is not within the data in the
first time, so the data in the second time cannot be filtered out.
Is there any problems for my code?
Thanks a lot,
Ray

"Bernie Yaeger" <be*****@cherwe llinc.com> ¦b¶l¥ó
news:eE******** ******@TK2MSFTN GP09.phx.gbl ¤¤¼¶¼g...
Hi Ray,

OK, looked at the code. When you call the report the second time, what is
the value of pfieldname and what code calls the report? It must be
different code, because if you called this code again, pfieldname would have to be the same (ie, abc).

Bernie

"Ray" <so*****@micros oft.com> wrote in message
news:ud******** ******@TK2MSFTN GP11.phx.gbl...
Hi all,
While I use the ReportDocument of vb.net to set filter to the data to
the
Crystal Report, it is successful for the first time while running the
program. However, for the second time while running the program, when I
set
filter to other set of data, all the data is lost.

Please help.
Thanks a lot,
Ray


Nov 21 '05 #5
Hi Ray,

No, the code looks fine.

Does the report use a physical table, a view, an sp or a dataset to report.
I understand your point about it having been already filtered - that could
only happen, I think (since the report is closed and then again opened), if
the report is using a dataset/datatable as its source.

Try this: in the second pass, use the same pfieldname; if it works, then you
are correct and the data is filtered and has remained filtered. But that
would mean that the report is using a dataset/datatable. Once we know this,
we should be able to fix it.

Bernie

"Ray" <so*****@micros oft.com> wrote in message
news:Ow******** ******@tk2msftn gp13.phx.gbl...
Dear Bernie,
I use the text box to input the data name should be filtered and then
pass to the ReportDocument.
So I use the same code in the second time also. For the first time, I
call the report by input a data name to the text box while running the
program, then I close the report, then I input another data name to the
text
box and call the report again. For this time, the necessary data cannot be
filtered out.
It seems that the report's data has been filtered to the data in the first
time, and since the data in the second time is not within the data in the
first time, so the data in the second time cannot be filtered out.
Is there any problems for my code?
Thanks a lot,
Ray

"Bernie Yaeger" <be*****@cherwe llinc.com> ¦b¶l¥ó
news:eE******** ******@TK2MSFTN GP09.phx.gbl ¤¤¼¶¼g...
Hi Ray,

OK, looked at the code. When you call the report the second time, what
is
the value of pfieldname and what code calls the report? It must be
different code, because if you called this code again, pfieldname would

have
to be the same (ie, abc).

Bernie

"Ray" <so*****@micros oft.com> wrote in message
news:ud******** ******@TK2MSFTN GP11.phx.gbl...
> Hi all,
> While I use the ReportDocument of vb.net to set filter to the data to
> the
> Crystal Report, it is successful for the first time while running the
> program. However, for the second time while running the program, when I
> set
> filter to other set of data, all the data is lost.
>
> Please help.
> Thanks a lot,
> Ray
>
>



Nov 21 '05 #6
Ray
Dear Bernie,
Yes, if the same pfieldname is used. The same data will be filtered. How
to fix the problem?
Thanks,
Ray
"Bernie Yaeger" <be*****@cherwe llinc.com> ¦b¶l¥ó
news:eg******** ******@TK2MSFTN GP15.phx.gbl ¤¤¼¶¼g...
Hi Ray,

No, the code looks fine.

Does the report use a physical table, a view, an sp or a dataset to report. I understand your point about it having been already filtered - that could
only happen, I think (since the report is closed and then again opened), if the report is using a dataset/datatable as its source.

Try this: in the second pass, use the same pfieldname; if it works, then you are correct and the data is filtered and has remained filtered. But that
would mean that the report is using a dataset/datatable. Once we know this, we should be able to fix it.

Bernie

"Ray" <so*****@micros oft.com> wrote in message
news:Ow******** ******@tk2msftn gp13.phx.gbl...
Dear Bernie,
I use the text box to input the data name should be filtered and then
pass to the ReportDocument.
So I use the same code in the second time also. For the first time, I
call the report by input a data name to the text box while running the
program, then I close the report, then I input another data name to the
text
box and call the report again. For this time, the necessary data cannot be filtered out.
It seems that the report's data has been filtered to the data in the first time, and since the data in the second time is not within the data in the first time, so the data in the second time cannot be filtered out.
Is there any problems for my code?
Thanks a lot,
Ray

"Bernie Yaeger" <be*****@cherwe llinc.com> ¦b¶l¥ó
news:eE******** ******@TK2MSFTN GP09.phx.gbl ¤¤¼¶¼g...
Hi Ray,

OK, looked at the code. When you call the report the second time, what
is
the value of pfieldname and what code calls the report? It must be
different code, because if you called this code again, pfieldname would

have
to be the same (ie, abc).

Bernie

"Ray" <so*****@micros oft.com> wrote in message
news:ud******** ******@TK2MSFTN GP11.phx.gbl...
> Hi all,
> While I use the ReportDocument of vb.net to set filter to the data to > the
> Crystal Report, it is successful for the first time while running the
> program. However, for the second time while running the program, when I > set
> filter to other set of data, all the data is lost.
>
> Please help.
> Thanks a lot,
> Ray
>
>



Nov 21 '05 #7

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

Similar topics

7
1433
by: AMeador | last post by:
I have, at one point in time, been a pretty good programmer, but that was years ago. I can pass programming classes with and A with no problem, but writting a business class application is a bit of a struggle. I am relitively new to .NET and C#, but do have pretty strong background in computers and general programming concepts. Now to my question. I have to create an app that will pull data from a database and create a report. This report...
3
5245
by: Diggler | last post by:
I was working on a report that is populated with three different tables in a strongly-typed dataset. The tables are populated from custom objects rather than directly from SQL Server. I loop through the objects and add the rows one at a time. I then push the dataset to the Crystal Report. The report worked fine, until this morning. I added another field or two to the dataset, and rearranged the report fields to organize the report...
1
1409
by: Brad Allison | last post by:
Okay, after spending the past 4 1/2 hours trying to figure this out I am getting some answers but I am also getting very frustrated. And again, if this is the wrong forum to post to I apologize. Why can I not use Crystal Reports to show data from a simple dataset? The problem I have is that when the report tries to access the data, I get a database login screen. It was suggested I use ODBC instead of OleDB (as I have been using - it...
0
1033
by: Ray | last post by:
Hi all, While I use the ReportDocument of vb.net to set filter to the data to the Crystal Report, it is successful for the first time. However, for the second time, when I set filter to other set of data, all the data is lost. Please help. Thanks a lot, Ray
0
1385
by: Ray | last post by:
Dear Bernie, Yes, if the same pfieldname is used. The same data will be filtered. But I only use the code shown you before. I have not used any dataset or datatable. How to fix the problem? Thanks a lot, Ray "Bernie Yaeger" <berniey@cherwellinc.com> ¦b¶l¥ó news:egBcd1QuEHA.3188@TK2MSFTNGP15.phx.gbl ¤¤¼¶¼g... > Hi Ray, >
3
1493
by: Chubbly Geezer | last post by:
I'm using a particular font (for credit card symbols) within a crystal report which looks fine when I preview, however when I run the report with real data, the font is now shown correctly. It seems to revert back to a standard font and displays letters instead of card symbols. Any ideas.? Can I embed a font or include one in my VB app.? Thanks
1
2195
by: mike11d11 | last post by:
For some reason I'm getting no data populating in my crystal report. I built my crystal report off my dataset in my project, and I fill the dataset when opening the main form, and count the records just to make sure there is data in the dataset, and then open the form containing my reportviewer control with the crystal report added to it and it still shows no data when it opens. I built my crystal report off the wizard when right...
0
1257
by: Sheryl 37 | last post by:
Can any1 give me the coding for the following problem.....How to i filter data in Crystal Report using a combo option (e.g Company Name). There1 combo box for the Company, and a crystal report. I'm using VB.Net 2005 Please help me i been figureing out for 2 weeks .....
1
1508
by: narpet | last post by:
Hello all... I have a C# forms application that I am developing using MS Visual Studio 2005. I am trying to add some Crystal Reports to this application using the built in Crystal Reports tools with Visual Studio. It seems like it should be pretty straight forward, but no matter what I do I can't get my reports to actually show data. Here's the info: I created a crystal report viewer on a form. I created a crystal report that has a data...
0
9619
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
10261
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
10038
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
9911
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
8934
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...
0
6713
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
5354
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...
1
4007
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
3609
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.