Programmatical SP crystal report

By hushed.names ·
I?m working on a software project in my employer company. The tool I use is and sql server 2000 back end. The software is a hotel software. I currently have three table in the database. Room, guestcheckedin and roomincome. Roomincome table contains income earned from room rents. I want to extract a daily report from this table. What the user should do is to give the date to the system and based on the date the user entered, the system gives the result in the crystal report. I want to do this programmatically.

When I say programmatically, when the user select report chose from menu the gets a Datetimepicker and a button objects. The user selects the date from the datetimepicker object and presses the button.

Based on the users choose the system will retrieve the data and shows it in the crystal report. I do all common steps that I found in the internet help sits. But when I click the button for execution of report the system asked me to enter a value for the parameter the stored procedure requires. I don?t like to see this dialog box that prompts input for parameter. I?ve given the parameter in the textbox I dropped already in the form and based on that parameter the system should give results. That is what I am trying to do. Please friends, help me. I?ve worked to solve this thing for the last 10 days and I?ve seen some 9 websites, but I couldn?t get exact solution that I am looking for. See the code below :

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim testrpt As New testCR
Dim conn As SqlConnection
Dim comm As New SqlCommand
Dim da As New SqlDataAdapter
Dim dset As New test

conn = New SqlConnection("Data Source=(local);Initial Catalog=Taitu ;User ID=Administrator;Integrated Security=SSPI")
' This is a stored procedure name

comm.CommandText = "selectDailyIncome"
comm.Connection = conn
comm.CommandType = CommandType.StoredProcedure

da.SelectCommand = comm
comm.Parameters.Add("@datefrom", SqlDbType.DateTime).Value = DateTimePicker1.Value.Date
da.Fill(dset, "roomincome")
' roomincome is a table where the stored procedure fetchs data from
CrystalReportViewer1.ReportSource = testrpt
End Sub

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums