Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a report that has a parameter field called ClientID

 

the selection formula in Crystal reports is

 

{vwLetterInfo.ClientID} = {?ClientID}

 

I obtain the ClientID from a Textbox in my Web Application

 

How do I pass the parameter to crystal?

 

I am very new to this, so any help would be appreciated. I looked and tried some examples already on this website (and many other websites), but none of them worked (Or I am not understanding them)

 

Here is the code that I have so far (this works as long as I do not try and call a parameter in crystal)

 

Dim myReport1 As New ReportDocument

 

myReport1.Load(RTrim(Request.Params("strName")))

CrystalReportViewer1.ReportSource = myReport1

CrystalReportViewer1.DataBind()

 

 

Thank you in advanced for any and all advice & help!

Posted

I worked out the solution. I am posting the code just in case someone has the same problem

 

Dim myReport1 As New ReportDocument

 

Dim paramFields As New ParameterFields

Dim param As New ParameterField

Dim ParamVal As New ParameterDiscreteValue

Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table

Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo

 

 

 

myReport1.Load(RTrim(Request.Params("strName")))

CrystalReportViewer1.ReportSource = myReport1

 

For Each tbCurrent In myReport1.Database.Tables

tliCurrent = tbCurrent.LogOnInfo

With tliCurrent.ConnectionInfo

.ServerName = "ServerName"

.DatabaseName = "DatabaseName"

.UserID = "UserID"

.Password = "PWD"

End With

tbCurrent.ApplyLogOnInfo(tliCurrent)

 

Next

 

param = New ParameterField

param.ParameterFieldName = "ClientID"

 

ParamVal = New ParameterDiscreteValue

ParamVal.Value = WebForm1.myClientID

 

param.CurrentValues.Add(ParamVal)

 

paramFields = New ParameterFields

paramFields.Add(param)

 

CrystalReportViewer1.ParameterFieldInfo = paramFields

CrystalReportViewer1.DataBind()

  • 2 years later...
Posted

Pass parameter to Crystal Report XI from Visual Basic 6

 

hi to all!

I am developing a program from visual basic 6 and I used the Crystal Report XI for the report. Now, how will i pass a given value from visual basic 6 to crystal report? In my program, the user will input a name. Then,in the CRViewer, the data under that name will be displayed.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...