Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to get Crystal reports XI to update SQL DB Post Reply Post New Topic
Author Message
Invisiblewar2
Newbie
Newbie


Joined: 15 Apr 2014
Online Status: Offline
Posts: 1
Quote Invisiblewar2 Replybullet Topic: How to get Crystal reports XI to update SQL DB
     Posted: 16 Apr 2014 at 11:47am
Hello Everyone,
 
I could use a little help here with a situation in Crystal Reports XI. I do apoligize however I'am new to using Crystal reports.
 
My question, is there anyway to get Crystal reports to update a SQL database?
If there is I'am not sure how to do this. The only option that I can think of would be to switch from using Crystal Reports to C# reports, this in my opinion is not a viable solution as the amount of reports that would need to be changed is 700+.
 
The situation:
 
We are printing cheques that have preprinted cheque numbers on them. in the event that the details before the cheque are fairly lengthy it automatically goes to a second page. The cheque number on the second page then becomes void.
We need to be able to update the SQL database with a new preprinted cheque number, or at least be able to return something from Crystal Reports to VB, so that I can then update the database.
 
Any advise would be great.
 
Thank you.


Edited by Invisiblewar2 - 16 Apr 2014 at 11:48am
IP IP Logged
adavis
Senior Member
Senior Member


Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Quote adavis Replybullet Posted: 18 Apr 2014 at 3:34am
I believe Crystal is simply a querying tool. You can view data, but you cannot edit data.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Apr 2014 at 3:44am
can you just stop the too lengthy items from printing anything over the amount that fits onto one page?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Apr 2014 at 5:22am
well...if you use a stored procedure, and you know the number detail lines that fit on a stub, you could have a store procedure update the database as it would know the number of checks that would be burned in the printing.

You would probably want to create some sort of option in the report to void the checks that are not being used...and of course there is the issue of reprinting a check that jammed in the printer or some such, but the application should take account of that and assist the stored proc.

otherwise, as adavis mentioned, CR is just a selection tool, it doesn't update the data...but a stored proc is more versatile and can update the data.

HTH
IP IP Logged
statey603
Groupie
Groupie
Avatar

Joined: 14 Aug 2013
Online Status: Offline
Posts: 78
Quote statey603 Replybullet Posted: 22 Apr 2014 at 4:03am
I have created Crystal Reports that call Oracle Stored Procedures to perform database Updates.
 
A requirement of Crystal Rpts is that the Stored Procedure return a REF Cursor object. It doesn't really matter if you do anything with it but it needs to be defined.
  
In my case we needed multiple procedures for different reports so I created a Crystal Reports Package in Oracle which contains all of the Stored Procedures. Below is a sample of the declaration of one of the procedures showing the input and output parameters.
 
On the Crystal Rpts side, I referenced the Stored Procedure via Database Expert. One weird thing with my configuration was that Stored Procedures were listed under the Qualifiers branch instead of the Stored Procedures branch in the Database Expert but I think this might be because the procedures are in a package.
 
Also, the stored procedure call was put in a sub-report in the Crystal Report. The input to the sub-report was a variable defined in the main report which was referenced in the subreport links.
 
PROCEDURE UPDT_LST_RUN_PROC
(
  InRptProcName IN VARCHAR2,
  OutPtrRecordset OUT SYS_REFCURSOR -- Rtrn Record Set
)
IS
-- LOCAL VAR DECLARATIONS
BEGIN
  -- PROCEDURE BODY
  blah blah blah
END;
 


Edited by statey603 - 22 Apr 2014 at 4:16am
-bill
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum