0

I have created stored procedure with 2 parameters
1. @rt_salesman,
2. @rt_name
I've been trying and searching to solve my case but I found no good answer. When I click my button I always got message :

Missing parameter values.

Can anyone help me to passing multiple parameter in Crystal Report with ASP.NET using VB? Here is my code snips:

Protected Sub cmdView_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdView.Click
    Dim crpt_ As New ReportDocument

    Dim paramField, paramField1 As New ParameterField()
    Dim paramFields, paramFields1 As New ParameterFields()
    Dim paramDiscreteValue, paramDiscreteValue1 As New ParameterDiscreteValue()

    paramField.Name = "@rt_salesman"
    paramField1.Name = "@rt_name"

    paramDiscreteValue.Value = "input_code"
    paramDiscreteValue1.Value = "input_name"

    paramField.CurrentValues.Add(paramDiscreteValue)
    paramFields.Add(paramField)

    paramField1.CurrentValues.Add(paramDiscreteValue1)
    paramFields1.Add(paramField1)

    paramFields.Add(paramField)
    paramFields1.Add(paramField1)

    crptViewer.ParameterFieldInfo = paramFields
    crptViewer.ParameterFieldInfo = paramFields1

    crpt_.Load(Server.MapPath(Request.ApplicationPath + "/r_salesman.rpt"))
    crpt_.SetDatabaseLogon("user", "password", "mydsn", "mydb")
    crptViewer.ReportSource = crpt_
End Sub
haraman
  • 2,744
  • 2
  • 27
  • 50
Afriza
  • 11
  • 1
  • 4
  • Hi Afriza, while you provide your code (certainly useful!) you don't describe what specifically you're having trouble with. If you elaborate on what behaviour you want, and what you're getting, you may get more helpful responses. – TZHX Oct 26 '15 at 14:44
  • when i click my button, i always got error message – Afriza Oct 26 '15 at 14:48
  • when i click my button to view the reports, i got the error message Missing parameter values – Afriza Oct 26 '15 at 14:48
  • @Afriza You can follow this SO post to add multiple parameters to Crystal Reports [How to pass values to two different parameters](http://stackoverflow.com/a/33185985/5104101). Everything is explained in the comments in code – haraman Oct 26 '15 at 14:56
  • i was try approach2, but i got error message CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid report file path. – Afriza Oct 26 '15 at 15:09
  • it works, sorry before i use the 2nd or 1st approach i have to place my report location first crpt_.Load(Server.MapPath(Request.ApplicationPath + "/r_salesman.rpt")) ' then the approach 1 and 2 put after this line.Thanks a lot . it's Work. – Afriza Oct 26 '15 at 15:26
  • 1
    Possible duplicate of [How to pass values to two different parameters](http://stackoverflow.com/questions/33127714/how-to-pass-values-to-two-different-parameters) – Steve Oct 26 '15 at 22:52

0 Answers0