Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a better/easier/shorter way? parameters
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Rapports
Titre:
Is there a better/easier/shorter way? parameters
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00976172
Message ID:
00976172
Vues:
59
After messing around all morning, I found a weblink that showed how to set the parameters on a crystal report so the darn crystal report dialogs don't show. The thing is, is seems like a ton of code to repeat for setting up each report. My report is based on a stored procedure with 3 parameters (2 date/time and 1 int) now as you all know in foxpro, we just build the report with the field name, called a sqlexec(nHandle,[myStoredProc ?m1,?m2,?m3) and run the report. Now the code I found today WORKS for vb.net. The intersting thing is how the person started there answer:

"Here's an easy way to pass parameters" followed by the following code:
'Declare variables needed to pass the parameters to the viewer control.
    Dim paramFields As New ParameterFields
    Dim paramField As New ParameterField
    Dim discreteVal As New ParameterDiscreteValue

    paramField.ParameterFieldName = "@ttStartDate"
    '*** SETTING THE FIRST DISCRETE VALUE & PASS IT TO THE PARAMETER ***
    discreteVal.Value = cStartDT
    paramField.CurrentValues.Add(discreteVal)
    '*** ADDING THE PARAMETER TO THE PARAMETER FIELDS COLLECTION ***
    paramFields.Add(paramField)

    '*** PASSING A SECOND PARAMETER (DISCRETE VALUE) ***
    paramField = New ParameterField
    paramField.ParameterFieldName = "@ttEndDate"
    discreteVal = New ParameterDiscreteValue
    discreteVal.Value = cEndDT
    paramField.CurrentValues.Add(discreteVal)
    paramFields.Add(paramField)
 
   '*** PASSING A THIRD PARAMETER (DISCRETE VALUE) ***
   paramField = New ParameterField
   paramField.ParameterFieldName = "@tiDeptID"
   discreteVal = New ParameterDiscreteValue
   discreteVal.Value = iDeptID
   paramField.CurrentValues.Add(discreteVal)
   paramFields.Add(paramField)
   
   Me.CrystalReportViewer1.ParameterFieldInfo = paramFields
Now this may be the easiest way (at least non-foxpro way), but it sure seems like a lot of work. If anybody has a better for efficeint way, I'd be excitted to see it.

Thanks

Kirk
Répondre
Fil
Voir

Click here to load this message in the networking platform