Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reports

Status
Not open for further replies.

eazadi

Programmer
Mar 3, 2006
5
DE
how can use crystal report parameter in asp.net .

 
eazadi: there exists a Crystal Report object which in Visual Studio you can simply drop/drag onto the form. Do a little research on the net visiting sites specific for using Crystal Reports with ASP.NET (there are many threads here you can review as well (use the "Search" function here at this forum).

From what I have heard (I do not use Crystal Reports) it is a bit of work getting started but once you put in a 100 or so hours its worth the payoff.
 
Hi eazadi,
You can try this....
For string parameter...

Dim crParameterField As CrystalDecisions.Shared.ParameterField
Dim crParameterValue As CrystalDecisions.Shared.ParameterDiscreteValue
crParameterField = Nothing
crParameterField = New CrystalDecisions.Shared.ParameterField
crParameterField.Name = [ parameter Name]
crParameterField.ReportParameterType = CrystalDecisions.[Shared].ParameterType.ReportParameter
crParameterField.ParameterValueType = CrystalDecisions.[Shared].ParameterValueKind.StringParameter
crParameterValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterValue.Value = [parameter value]
crParameterField.CurrentValues.Clear()
crParameterField.CurrentValues.Add(crParameterValue)
cv.ParameterFieldInfo.Add(crParameterField)

cv is your Crystal report viewer control in ASP.NET
 
HEllo everyone. I am trying to accomplish the same thing as eazadi. I have a sql stored procedure with dateclose parameter. Now to pass the value the user selects from calendar drop down control to the crystal report. I am using the push methods. Here what the form that has the crystal report viewer on it.
I call the BindReportToDS from the onload event of the page.
Sub BindReportToDS()
Dim myconnection As New SqlClient.SqlConnection
'myconnection.ConnectionString = "server=server;database=northwind;uid=guest;pwd=guest2"
' myconnection.ConnectionString = ("Data Source=DISYSTEMS;" & _
'"Initial Catalog=HelpDesk;user id=sa;password=password;")
myconnection = New SqlConnection(ConfigurationSettings.AppSettings("Connection").ToString)

Dim mycmd As New SqlClient.SqlCommand
mycmd.Connection = myconnection
mycmd.CommandType = CommandType.StoredProcedure
'mycmd.CommandText = "uspTicketClosedByMonth"
mycmd.CommandText = "Select * uspTicketClosedByMonth where "
If TextBox1.Text <> "" Then 'here I am reading the value of the date that pass from the previouspage where the user selects a date and store it in the Textbox1

mycmd.Parameters.Add("@dtDateClosed", CDate(TextBox1.Text))
Else
mycmd.Parameters.Add("@dtDateClosed", Now())
End If



Dim myda As New SqlClient.SqlDataAdapter
myda.SelectCommand = mycmd
Dim myDs As New OpenTicketsByMonth
myda.Fill(myDs, "uspTicketClosedByMonth")



mycmd.Dispose()
myconnection.Close()

' Set up a new instance of the Report
Dim oRpt As New rptClosedTicketsByMonth
oRpt.Load()
oRpt.SetDataSource(myDs)
CrystalReportViewer1.ReportSource = oRpt
myconnection.Close()

I would appreciate any help. Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top