473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Missing Parameter values in Crystal reports

When i run the page i'm getting a message showing."Missing Parameter values" and want display the report. i've used following formula
Expand|Select|Wrap|Line Numbers
  1. Year ({tbl_DisasterRegistration.Date})  =  Year (CurrentDate)  - {?@YearCount}
By right click on the report...Report->Selection Formula->Record

my code is used in DropDownList1_SelectedIndexChanged

Expand|Select|Wrap|Line Numbers
  1. ReportDocument crystalReport = new ReportDocument();
  2.             crystalReport.Load(Server.MapPath(@"/Presentation Layer/Reports/YearlyStatistics.rpt"));
  3.             crystalReport.SetDatabaseLogon("", "", "XPWINDOWS7\\SQLEXPRESS", "PODRAS_MS");
  4.             ParameterFieldDefinitions crParameterFieldDefinitions;
  5.             ParameterFieldDefinition crParameterFieldDefinition;
  6.  
  7.             ParameterValues crParameterValues = new ParameterValues();
  8.             ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
  9.  
  10.  
  11.             crParameterDiscreteValue.Value = Convert.ToInt32(DropDownList1.SelectedItem.Value);
  12.             crParameterFieldDefinitions = crystalReport.DataDefinition.ParameterFields;
  13.             crParameterFieldDefinition = crParameterFieldDefinitions["@YearCount"];
  14.             crParameterValues = crParameterFieldDefinition.CurrentValues;
  15.  
  16.             crParameterValues.Clear();
  17.             crParameterValues.Add(crParameterDiscreteValue);
  18.             crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
  19.  
  20.             CrystalReportViewer1.ReportSource = crystalReport;
  21.             CrystalReportViewer1.RefreshReport();
i also tried this on page load event by giving
Expand|Select|Wrap|Line Numbers
  1. crParameterDiscreteValue.Value =1
same error occurs???

can anyone help???
Jul 25 '10 #1
3 10129
Jyoti Ballabh
115 100+
maybe, you need to reset the parameter as follows-

Expand|Select|Wrap|Line Numbers
  1. ParameterDiscreteValue discreteVal = new ParameterDiscreteValue();
  2. ParameterRangeValue rangeVal = new ParameterRangeValue();
  3. ParameterValues curvalues = new ParameterValues();
  4. foreach (ParameterFieldDefinition parafld in 
  5.              crReport.DataDefinition.ParameterFields)
  6. {
  7.   if (parafld.DiscreteOrRangeKind.ToString() == "DiscreteValue")
  8.   {
  9.     discreteVal.Value =
  10.  
  11.            Request.QueryString[parafld.ParameterFieldName];
  12.     if (discreteVal.Value != null)
  13.     {
  14.       curvalues.Add(discreteVal);
  15.       parafld.ApplyCurrentValues(curvalues);
  16.     }
  17.   }
  18.  
  19. }
Jul 25 '10 #2
cr4sh
20
your approach to the whole problem is great. have a look at the parameter sequencing in the code below.....

Expand|Select|Wrap|Line Numbers
  1. Dim objReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
  2. Dim ConInfo As New CrystalDecisions.Shared.TableLogOnInfo
  3. Dim paraValue As New CrystalDecisions.Shared.ParameterDiscreteValue
  4. Dim currValue As CrystalDecisions.Shared.ParameterValues
  5. Dim sParValPair() As String
  6. Dim sValue() As String
  7. Dim iIndex As Integer
  8. Dim crFieldDef As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
  9. Dim crFieldLoc As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
  10. ConInfo.ConnectionInfo.ServerName = modLibrary.m_sDATASOURCE
  11. ConInfo.ConnectionInfo.DatabaseName = modLibrary.m_sDATABASE
  12. ConInfo.ConnectionInfo.IntegratedSecurity = True
  13. objReport.Database.Tables(intCounter).ApplyLogOnInfo(ConInfo)
  14. crFieldDef = objReport.DataDefinition.ParameterFields
  15. sParValPair = sParam.Split(";")
  16. For iIndex = 0 To UBound(sParValPair)
  17.    If InStr(sParValPair(iIndex), "=") > 0 Then
  18.       sValue = sParValPair(iIndex).Split("=")
  19.       crFieldLoc = crFieldDef.Item(sValue(0))
  20.       currValue = crFieldLoc.CurrentValues
  21.       paraValue.Value = sValue(1)
  22.       currValue.Add(paraValue)
  23.       crFieldLoc.ApplyCurrentValues(currValue)
  24.    End If
  25. Next iIndex
Jul 25 '10 #3
Thanks for the replies problem was resolved by removing
Expand|Select|Wrap|Line Numbers
  1. CrystalReportViewer1.RefreshReport();
Jul 26 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Scott Hatfield | last post by:
Hello, all. I'm a newbie to Python and am using it to interface with crystal reports via com/activex. I have had wonderful success thus far, but am unable to pass a parameter of type 'date.' ...
2
by: PK | last post by:
Hi, I have an application that opens a Crystal report document and passes in a value to a parameter in the report (pointing to an Oracle DB). However, if I want to pass a "null" value to retrieve...
0
by: Dean Sabella | last post by:
Hi, I was trying to run a crystal report in the .net sample application given at: http://support.crystaldecisions.com/communityCS/FilesAndUpdates/ cppnet_win_subreport_basic.exe.asp (I've...
2
by: drisso | last post by:
Hello, I have searched that error on these message boards, msdn and crystaldecisions.com. I found tutorials that showed how to export a crystal report to pdf, but like many others I am getting...
4
by: touf | last post by:
hi, I'm using Crystal reports to generate a simple report in a VB.net windows application, I've defined all my stuffs (accessMDB,query, 2 parameters) in the report design, and it's working fine,...
1
by: Hardy Wang | last post by:
Hi all, I have a piece of code in my C# console application to export from crystal report files to PDF. For some reports files, I get errors below. I have Crystal Reports 8.5 with service pack...
3
by: LataChavan | last post by:
I have tried to look for a solution to the problem of sending parameters to stored procedures through crystal report. Following is the code: Now what happens is that if i do not apply the logon...
4
by: Lawrence 007 | last post by:
Hi, I am using a dataset for my Crystal report. Query: Select * from Orders where Date = @Date How do I pass that to my Crystal Report. This will be passed with a calander I have on my form...
0
pankrias
by: pankrias | last post by:
ive created a vb.net windows app (vs.net 2005 crystal reports XI) to read console arguments when it is called. the console arguments are passed to the windows form and then used to access the report...
0
by: benwizzle | last post by:
I wasnt quite sure where to put this but I am having a dilemma here with some encryption I have implemented while using crystal reports with my project. My issue is that I have an encrypted field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.