Joined: 03 Jan 2008
Location: United Kingdom
Online Status: Offline
Posts: 2
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...
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
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>
Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
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>
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