Print Page | Close Window

Runtime FieldObjects

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Writing Code
Forum Discription: .NET 2003 programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=49
Printed Date: 29 Apr 2024 at 6:05am


Topic: Runtime FieldObjects
Posted By: normality2000
Subject: Runtime FieldObjects
Date Posted: 13 Dec 2006 at 1:20am
Greetings!
 
I've been asked to carry out the joyful painful task of replacing numerous ad-hoc homebrew-yet-mission-critical MS Access databases (used to report on datasets that are populated by a third party piece of software) with nice, clean, VB.Net applications that allow the user to control the parameters to a hidden bit of SQL that, in turn, will populate a reporting tool.
 
Obviously, I am trying to use the embedded CR.NET tool but have come across a major hurdle in that although I can create a report then populate it from the .NET environment, I don't seem to be able to create a bespoke report in code, from scratch.
 
Does anyone have any code that illustrates how I can create FieldObjects (TextObjects etc.) at Runtime and on the fly, rather than having to create a Report with all the necessary objects, then populating them from the .NET environment?
 
Even if the comment 'it can't be done' gets posted back, it will save me fruitless hours of searching on the interweb!



Replies:
Posted By: BrianBischof
Date Posted: 13 Dec 2006 at 9:51am
Let me save you a lot of time: It can't be done.

Now here are some options: You can create all those useless textboxes and then in your code hide them. That way you don't worry about populating them from the .NET environment because they won't appear anymore.

Secondly, you can upgrade your version of Crsytal Reports. I think that the Developer edition lets you build reports on the fly during runtime. If not, I definitely know that CR Server lets you do this. Unfortunately, I haven't looked at the different product licenses in over a year so I'm not definite whether the Developer edition lets you do this or not. Developer is only a couple hundred dollars and within it they give you a limited version of CR Server for free. Thus, you might be able to get away with using the free copy of CR Server.

I suggest you go to the Business Objects website and download the 30 day trial of Developer edition and experiment with it (and report back to us your experience!)

HTH.


Posted By: ksmps
Date Posted: 13 Dec 2006 at 10:38am
hi
i think the following code would help you
 
i tried and it is working
 
This code you write in button click event.

Make Data base connection

In data base connection and in the sql query pass the parameter from text box or combo or other controls.


data adapter is filled with data set


like da.Fill(ds,"table Name")

dt = ds.tables("Table Name")

where dt = object of Data table.

declared as dim dt as new Datatable

c1.set Data source(dt)

c1.refresh()

here C1 is object of Crystal report

declared as


dim c1 as newCrystalreport


Crystalreportviewer1.reportsource=c1

 


 



-------------
parthasarathy


Posted By: normality2000
Date Posted: 14 Dec 2006 at 1:11am
Thanks for a prompt response Brian.  I suspected it was the case that the version I've been given to develop on wasn't really up to the job!  Do you think an upgrade to VS.NET 2005 would help or is it a case of upgrading a standalone copy of Crystal Reports to the Developer version and letting VS "take care" of CR.NET?


Posted By: normality2000
Date Posted: 14 Dec 2006 at 1:26am
KSMPS,
Thanks for your info, but what I am trying to achieve is slightly more advanced than connecting to the datasource!  I am going to test the developer edition as suggested by Brian and see how I get on.


Posted By: BrianBischof
Date Posted: 14 Dec 2006 at 11:18am
VS.Net 2005 won't give you what you want. To get that much functionality, you have to spend a few bucks to upgrade to the next level of Crystal Reports (either Developer or CR Server).

If you have time, please report back your findings once you had a chance to play with the trial version so that we can all learn from it.

Thanks!


-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window