Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal report reading SQL Server parameters Post Reply Post New Topic
Author Message
CRNewbie32
Newbie
Newbie
Avatar

Joined: 14 Oct 2008
Location: United States
Online Status: Offline
Posts: 22
Quote CRNewbie32 Replybullet Topic: Crystal report reading SQL Server parameters
     Posted: 14 Oct 2008 at 7:48am
I have a stored procedure in SQL Server that has two datetime parameters. Crystal doesn't seem to work with them. I've read all kinds of things on the 'Net but have not found a solution yet. If you make the parameters varchar then Crystal reads it as a string and the user doesn't get the calendar thing to choose the dates.
 
Here's the most recent thing I got from another forum but I don't get any results:

alter PROCEDURE [dbo].[Trans_History3_Crystal_Account_pr]

@Company AS INT

,@Accounts AS VARCHAR(100)

,@AccountingUnit as VARCHAR(100)

,@BegSubAcct as INT

,@EndSubAcct as INT ,

@SDate AS VARCHAR(11)

,@EDate AS VARCHAR(11)

,@LRange as Bit

,@NoBalAct as bit

 

 

--1st test to get zero records ddr 9/24/08

--exec Trans_History3_Crystal_Account_pr 3000,'10010,10010','ALL',0,999, '01/01/2007','01/01/07',0,1

--exec Trans_History3_Crystal_Account_pr 9330,'10000,99999','ALL',0,999,'05/01/2008','07/31/2008',1,1

--NOTE: This code is separated by sorting acct_unit, accounts and then by accounts,acct_unit

--Accordingly, you need to change both sets of Crystal code for any enhancements/bugs ddr 8/15/08

AS

----***********NOTES

----used Running Balances code found on the Internet ddr 9/10/08

----This procedure is used to get beginning balance (based on parameters)

----transactions with date range and calculate and ending balance

----It's a basic general ledger for the clients

----************

--

--***LEAVE DECLARED

--PRINT @StartDate

--PRINT @EndDate

DECLARE @StartDate AS DATETIMEDECLARE @EndDate AS DATETIME

set @StartDate = cast (@SDate as datetime)

set @EndDate = cast(@EDate as datetime)

set @SDate = cast (@StartDate as datetime)

set @EDate = cast(@EndDate as datetime)

--SELECT @StartDate AS StartDate, @EndDate AS EndDate, @SDate AS SDATE, @EDate AS EDATE

 

This is how I'm running it:

--exec Trans_History3_Crystal_Account_pr 9330,'10000,99999','ALL',0,999,'05/01/2008','07/31/2008',1,1

Any help would be greatly appreciated.
TrytoworkwithSQLServerCrystal
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 14 Oct 2008 at 9:53am
I've seen similar posts, but I haven't had any problems using DateTime params with a SP. What version are you using and which database?
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
CRNewbie32
Newbie
Newbie
Avatar

Joined: 14 Oct 2008
Location: United States
Online Status: Offline
Posts: 22
Quote CRNewbie32 Replybullet Posted: 14 Oct 2008 at 10:02am
I'm on Crystal XI and SQL Server 2005. I think it's a problem with LBI on Lawson 9 that we're trying to install. My report was working fine (it's hosed up now with all the experimentation)--I think it was an LBI problem that I should have pushed back on. I'm going to try to get it working and go from there. If you hear of any LBI issues, please let me know. Thanks for your time.
TrytoworkwithSQLServerCrystal
IP IP Logged
angel1111
Newbie
Newbie
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 2
Quote angel1111 Replybullet Posted: 16 Oct 2008 at 6:57am

did you try simply declaring the date parameters as datetime with procedure create statement. that way, the procedure provides the parameter for the report. its more straightforward. hope it helps.

angel111
IP IP Logged
CRNewbie32
Newbie
Newbie
Avatar

Joined: 14 Oct 2008
Location: United States
Online Status: Offline
Posts: 22
Quote CRNewbie32 Replybullet Posted: 16 Oct 2008 at 7:07am
The parameters are in the right order because SQL Server and Crystal work okay by themselves. It's only when it's published to Lawson's LBI that the calendar control doesn't work and only if regular user log-on is used (admin log-on seems to work). I've kicked the problem over to Lawson and our consultant because I don't have the log-on to give Lawson the info they need. Thanks anyway.
TrytoworkwithSQLServerCrystal
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