473,387 Members | 1,742 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,387 software developers and data experts.

Dynamic SQL based Crystal Reports

Hey all,

Been working with the Crystal Report Viewer, and have run into a situation I
am hoping someone can help me get past. This may be more of a CR question,
but hoping for some CR gurus to stop by in here.

Crystal's knowledgebase has made available a bunch of examples for both
ASP.Net and VB.Net applications for download and review (I added the links
at the end of this post). One of the examples is how to pass in a parameter
to the form from the .aspx page so you can alter what is displayed. However,
on closer inspection, you find that the form pulls across a huge set of
records and merely filters out all records not in the group matching the
parameter passed in.

My snag is that I do not want to pull across a huge set of records, rather I
would prefer to use a stored procedure on the SQL Server that accepts a
parameter and returns only those records I want. The records are the same
structure every time, just the content may be different. While the example
shows how to pass in the parameter, I do not know how to set up the form to
utilize not just a Stored Procedure, but rather one that requires a
parameter.

In short: Create an ASP.Net page that displays a Crystal Report whose data
is determined by a parameter passed in to the report and used in a Stored
Procedure tying it to a SQL Server.

Has anyone in here run into this situation and can explain how to deal with
it?

-- Andrew

Crystal Decisions Project Examples:
--------------------------------------------
VB .NET Web Sample Applications
http://support.businessobjects.com/c...amples.exe.asp

VB .NET Windows Sample Applications
http://support.businessobjects.com/c...amples.exe.asp

Nov 18 '05 #1
4 4623
"Andrew" <An********@hotmail.com> wrote in
news:OG**************@TK2MSFTNGP11.phx.gbl:
My snag is that I do not want to pull across a huge set of records,
rather I would prefer to use a stored procedure on the SQL Server that
accepts a parameter and returns only those records I want. The
records are the same structure every time, just the content may be
different. While the example shows how to pass in the parameter, I do
not know how to set up the form to utilize not just a Stored
Procedure, but rather one that requires a parameter.


Here is what I do:
1. Create an stored procedure

2. Create an ADO.NET Recordset (Add New Item -> Dataset) in Visual
Studios

3. Create a new Report - referecing the ADO.NET report

4. Fill the Dataset with the Report Data. Be sure to name the tables in
the Dataset - CR needs the proper dataset table names to load the data
properly.

5. Bind the dataset to the report.
BTW, you may want to use the System.reflection classes to create a
dynamic loader - that is what I do an works very well.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #2
Lucas Tam,

Thanks for the response and suggestions. I will go see if I can get
this to work...it sounds just like what I need to do. I smacked my forehead
for not thinking of it myself. :)
In the mean time -- and if you see this message -- if I could ask a
couple quick questions....

1) Do I have to use the GUI version (or "drag&drop" version) of the
ADO.Net Dataset, or can I use one coded by hand to bind to? I ask this
because I crerated a .Net DLL that handles all of my Dataset, DataReader, DB
Connectivity, etc., stuff (cuts down on the rewriting of code time) and
would like to use that if possible.

2) I am not quite sure I follow your suggestion of using the
System.Reflection classes. Are you saying to create a sub/function that
sets up the Dataset per passed in info prior to binding the CRViewer upon
page load? Or are you talking about something else? I figured to simply do
the former: read in some data passed through ah HTML Form or URL Item, set
up the Dataset's SQL statement from these, get the records, bind the report,
and view the page. If you are suggesting an alternate method, I am always
open to new ideas.

The usage of the CRViewer is still very new to me, as well as still
being fresh to .Net. I appreciate your help. Thanks again.

-- Andrew
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. .
"Andrew" <An********@hotmail.com> wrote in
news:OG**************@TK2MSFTNGP11.phx.gbl:
My snag is that I do not want to pull across a huge set of records,
rather I would prefer to use a stored procedure on the SQL Server that
accepts a parameter and returns only those records I want. The
records are the same structure every time, just the content may be
different. While the example shows how to pass in the parameter, I do
not know how to set up the form to utilize not just a Stored
Procedure, but rather one that requires a parameter.


Here is what I do:
1. Create an stored procedure

2. Create an ADO.NET Recordset (Add New Item -> Dataset) in Visual
Studios

3. Create a new Report - referecing the ADO.NET report

4. Fill the Dataset with the Report Data. Be sure to name the tables in
the Dataset - CR needs the proper dataset table names to load the data
properly.

5. Bind the dataset to the report.
BTW, you may want to use the System.reflection classes to create a
dynamic loader - that is what I do an works very well.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #3
"Andrew" <An********@hotmail.com> wrote in
news:ej**************@TK2MSFTNGP10.phx.gbl:
1) Do I have to use the GUI version (or "drag&drop" version) of
the
ADO.Net Dataset, or can I use one coded by hand to bind to? I ask
this because I crerated a .Net DLL that handles all of my Dataset,
DataReader, DB Connectivity, etc., stuff (cuts down on the rewriting
of code time) and would like to use that if possible.
You use the GUI version to generate a Dataset. This dataset will be
referenced by Crystal Reports.

You will still need fill the dataset tho.

BTW, take a look at Microsoft's Data Building Blocks. Microsoft has
already written a set of classes to handle typical ADO.NET operations.
2) I am not quite sure I follow your suggestion of using the
System.Reflection classes. Are you saying to create a sub/function
that sets up the Dataset per passed in info prior to binding the
CRViewer upon page load? Or are you talking about something else? I
figured to simply do the former: read in some data passed through ah
HTML Form or URL Item, set up the Dataset's SQL statement from these,
get the records, bind the report, and view the page. If you are
suggesting an alternate method, I am always open to new ideas.


I'm using the System.Reflection classes to dynamically instantiate the
reports. I'm using the embedded version the reports - rather than
loading the reports off the disk, I am dynamically invoking a new
instance of each rpeort by calling the report's respective classes.

If this doesn't make sense to you, there are two ways of loading a CR
report. Either off a disk or by calling a report's classname and
instantiating it that way.

Reading off a disk is good if you wish to edit your reports often.
Instantiating a report via it's class name is good if you wish to embed
the reports inside the DLL and not have the report files exposed to the
outside world.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #4
>
You use the GUI version to generate a Dataset. This dataset will be
referenced by Crystal Reports.

You will still need fill the dataset tho.
Got it. Built a quickie test page, and everything runnning smoothly.
Thanks for the help on this one. Can't believe how quick and easy this
was....waiting for something to go wrong. :)

BTW, take a look at Microsoft's Data Building Blocks. Microsoft has
already written a set of classes to handle typical ADO.NET operations.

I will look into this, thanks for the heads up. :)

Instantiating a report via it's class name is good if you wish to embed
the reports inside the DLL and not have the report files exposed to the
outside world.


Ahhh, was doing this already, just didn't follow the way you were referring
to it. :)

Again, thanks for your help, and I hope I can ask you questions in the
future if I run into more snags.

-- Andrew
Nov 18 '05 #5

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

Similar topics

2
by: Sam | last post by:
Hello everyone, I have a table, which contains a picture column, I put URL info into it. "www.myweb.com/1.jpg..." I want to show this picture in my crystal report, I find some samples show the...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
1
by: Rutko | last post by:
Is it possible to dynamically create report and save it in rpt file? For example I want to add an text object in report on x,y position in page header. I need that dynamically, because I have a...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
5
by: Ron | last post by:
I have a bunch of Crystal Reports (v9) published as WebServices and use a ReportViewer to display the reports on the ASPNET page. Everytime we move the reports from dev to production we have to...
4
by: Diego F. | last post by:
Is it possible to generate dynamic reports with Crystal? I'm having problems printing a datagrid because the last line of each page gets cut, so I was thinking of using Crystal. I want to simply...
0
by: PughDR | last post by:
As the subject of this topic suggestions I am trying to find a way to use ASP, SQL Server, Com+ and Crystal Reports 8.5 to Create Dynamic PDF Reports Over The Web, but the only article I found that...
7
by: Jlo | last post by:
Hi, I have a c# winforms application. When I call the report file, it shows me all the records in the table. How can I make it to call only a particular range. i have the following code...
1
by: bhappy | last post by:
Hai All, I want to create crystal reports dynamically, I don't know the columns i will take it from database at runtime, im getting all data into one dataset and im convrting dataset into xml...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...

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.