Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: re-inserting data into my database Post Reply Post New Topic
Author Message
Dominic
Newbie
Newbie


Joined: 03 Jan 2008
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote Dominic Replybullet Topic: re-inserting data into my database
    Posted: 03 Jan 2008 at 2:11am
Hi
 
I'm trying to work out of this is possible at all:
I want to be able to store some of the Total value frields from some of my reports in my database.
 
I read in Brians book, that it is possible to re-insert data into a database, which i have successfuly done, but i have only manged to insert a date using the SQL getdate() function.
 
I can't work out how to use CR Variables in an SQL expression...
 
Thanks in advance for any advice
 
Dom
 
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Jan 2008 at 9:09pm
First off, thanks for buying the book! I hope that it is helping you out.

Re your question, inserting data from CR into SQL is tricky b/c each step is very important. Unfortunately, it's difficult to debug something like this over the forum. Make sure you review the steps on page 439 through 441. Make sure that the stored procedure is in a subreport that comes after you calculate the Total value and also make sure that the stored procedure returns a dummy value (otherwise CR will ignore it and not do the insert).

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>
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Jan 2008 at 9:12pm
Wait a minute, I just noticed that you said you were using SQL Expressions. This doesn't work for saving CR data into you database. You need to use a stored procedure which has a parameter that accepts the value you want to save. In the stored procedure call the Update or Insert statement to save the data. The key is for the stored procedure to use input paramters so that it can accept the data from your report.
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>
IP IP Logged
Dominic
Newbie
Newbie


Joined: 03 Jan 2008
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote Dominic Replybullet Posted: 08 Jan 2008 at 3:44am
No problem, the book has been a great help actually!
 
Thanks, using the information you just gave, and the info from this thread
 
I've managed to re-insert data into the database!
 
Thanks again!


Edited by Dominic - 08 Jan 2008 at 3:47am
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.