Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2006, 10:00 AM
Registered User
 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Crystal Report Parameter Not Working

I m working in a windows base project with C# coding. I have used Crystal Report bundeled with Visual Studio 2005. This code I have written to solve issue of database server settings or when database location is changed. At the time of deployement of project at other location Crystal Report doesn’t ask again for password and user id with this below mention code.

But after implementing this code I have found my parameters which are used to fatch record from SQLEXPRESS is not working. But parameter like Header value is displayed in the Report. Is there any solution any one is having for parameter value passed to SQLEXPRESS.

Please note that if I don’t use last third line code then parameter works. But again the problem of deployment at client end arises.

“myReportDocument.Database.Tables[0].ApplyLogOnInfo(LogInfo);”


I m using database expert for binding database stored procedure.

This is my code

LogInfo.ConnectionInfo.ServerName = "DataSource";
LogInfo.ConnectionInfo.UserID = "UserID";
LogInfo.ConnectionInfo.Password = "Password";
LogInfo.ConnectionInfo.DatabaseName = "Database";

To pass parameters in report I have written this code :


parameterDiscreteValue[0].Value = value ;
parameterField[0].ParameterFieldName = "@CustomerID";
                    parameterField[0].CurrentValues.Add(parameterDiscreteValue[0]);
parameterFields.Add(parameterField[0]);
parameterField[1].ParameterFieldName = "@Header";
parameterDiscreteValue[1].Value = " Report : Customer Details";
                    parameterField[1].CurrentValues.Add(parameterDiscreteValue[1]);
parameterFields.Add(parameterField[1]);
crystalReportViewer1.ParameterFieldInfo = parameterFields;

//to load report in document
myReportDocument.Load(REPORTLOCATION + "\\GenerateOrderListRep.rpt");

            myReportDocument.Database.Tables[0].ApplyLogOnInfo(LogInfo);

//pass userid & Password
myReportDocument.SetDatabaseLogon(["UserID"],["Password"]);

//called report
crystalReportViewer1.ReportSource = myReportDocument;









Similar Threads
Thread Thread Starter Forum Replies Last Post
crystal report parameter sportforever Crystal Reports 4 April 10th, 2008 03:32 AM
crystal report parameter angelboy C# 2005 2 April 22nd, 2007 07:59 AM
parameter sending to crystal report shahzadmalik Crystal Reports 0 March 2nd, 2007 02:30 AM
Crystal Report Parameter sujah.s ASP.NET 1.0 and 1.1 Basics 0 May 29th, 2006 04:59 AM
Crystal Report Parameter BKunneke VB.NET 2002/2003 Basics 1 June 13th, 2005 09:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.