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