Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Stored in SQL Server? 1

Status
Not open for further replies.

marcusw

Programmer
Jan 18, 2001
35
GB
Does anyone know if it is possible to store a Crystal Report in a SQL Server Database table/field? I had heard that they could be stored as binary objects.

I want to distribute a report to an end user but don't want them to access or even see a '.rpt' file.

Thanks,

Marcus.
 
Marcus,

Yes, this is possible. Basically, you need to create a field of datatype IMAGE on the server (or you could create it as TEXT; the two are pretty well identical). You then use the WRITETEXT statement (in T-SQL) to write the contents of the RPT to the field. Exactly how you do that depends on your client language.

Out of curiosity, why do you want to distribute a file that you don't want anyone to know about?

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Dear Mike,

Greetings! I'll bite -- please post an example of how to insert a CR into MS SQL Server.

Thanking-you in advance.



James Keep, A.C.E.
Crystal Reports(tm) Certified Consultant 8.5 (CRCC)
CMRC
Crystal Decisions Business Partner
Montreal, Qc, Canada
 
Thanks Mike,

I don't really want to put an .rpt in a directory if I can help it as this would give the user the opportunity to use Crystal to modify it and potentially break it.

Also, the reports will be producing sensitive data so there is a security issue and it would be more secure to have it in a SQL DB.

I'd also like to see an example of how this could be done.

Thanks again for your help!

Marcus.
 
Here's a thread from the one of the VB forums with sample code to upload/download a file into/from a SQL Server database: thread709-626959.

Our main application (written in Delphi) does this. The reports are displayed under menu items within the app, but aren't downloaded to the client machine until they click on one.

We've even got edit/upload capability within the app, meaning if a user has Crystal installed, they can open an existing report in the Crystal designer with a few clicks, then upload it back into the db (if they want to) when they're finished editing.

-dave
 
Marcus,

So, you are saying that you do want to allow the user to run the report. You just don't want to let them modify it.

In that case, a simpler solution might be to deploy a third-party report viewer, such as Ido Millet's DataLink Viewer ( That way, you don't even need the user to have CR installed. The DataLink Viewer also allows you to encrypt a report so that only you (the designer) and the viewer itself can work with it.

Marcus and James,

You asked for code to store the report file in an Image field. What client language are you using? My preferred language is Visual Foxpro, and at a pinch I could write some quick code in that language. I don't know VB, Delphi or others well enough.

Mike




Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks for all your help. I'm developing in VB.NET so will look a bit closer at this.

Regards,

Marcus
 
Virdu: Thanks for the thread 709-626959. Just taking a look at it now.

Mike: We are using VB for the client's Crystal Reports on MS SQL Server. I am going to hand off the new found thread to our programmers.

Thanks to All!!


James Keep, A.C.E.
Crystal Reports(tm) Certified Consultant 8.5 (CRCC)
CMRC
Crystal Decisions Business Partner
Montreal, Qc, Canada
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top