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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal passes null value to stored procedure

Status
Not open for further replies.

dwooten

Technical User
Jul 14, 2005
18
US
I have a linked sub report that uses a stored procedure but the parameter being passed to stored procedure is always NULL even though it should contain a value.
 
To pass a parameter to a subreport, you should use Edit > Subreport Links. Have you done that?

Does the parameter display OK in the subreport?

As for use in a 'stored procedure', do you mean an SQL Command? Code you add yourself to do the selection etc.? If so, you might have difficulty adding the parameter to that code. It would probably depend on the version. It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.

One possibility is for the SQL Command to select evertyhing and the parameter to do the selection in Record Selection.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
dwooten is working with me on this problem and posted this for me. So here is more information.

I am using a stored procedure in a crystal report subreport as a datasource. In other words, it looks just like a table.

I have one parameter ?@StudentID in the subreport which is automatically added to the subreport from the stored procedure in crystal. I have linked the StudentID field from the appropriate table in the main report to the ?@StudentID parameter in the subreport.

When I run the report on my developer machine in CR 10, 2008 or 2011 developer, I get results as I should. But when I put the report on my production machine the subreport is blank.

I ran a sql trace to find out why and discovered that the crystal runtime engine is executing the stored procedure with a null parameter.
 
I don't understand why I am having this issue. I started with the problem of not being able to verify database on the stored procedure in crystal 10. I later found out that this was caused by using the wrong version (2008) of odbc drivers.

Before I discovered that I was recommended to update crystal. I installed 2011 and then started having the null parameter issue. I uninstalled 2011 and reinstalled v10 but still had the null issue. I uninstalled v10 and installed 2008 but same issue remained.

I don't think the issue is with the runtime crystal engine (10.2) on the production server because I haven't changed anything there and crystal v10 used to work.

Hoping for a guru who can tell me what the answer is. It's been almost a month of working on this problem.
 
Nothing I'm familiar with, sorry. I suggest you start a new thread, maybe in forum 2, saying it is to do with 'drivers'

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Thanks. I'll copy the info to forum 2 just in case. I am not sure that the problem is a driver problem though. But it sure can't hurt to try there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top