Question : Stored Procedure not working in Crystal

I have a stored procedure that will be used in a crystal report. When I run the SQL as a select query, it displays the results I am looking for, but when I run it as a procedure and call it in Crystal Reports, I am getting no results at all. Can someone give me some advice? Does it have something to do with my parameter?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
_Command = New SqlClient.SqlCommand
        _TimeOneDataSet = New TimeOneDataSet
        _Connection = New SqlClient.SqlConnection(ConnectionString)



        _Command.CommandText = "sp_reports"
        _Command.CommandType = CommandType.StoredProcedure
        _Command.Connection = _Connection

        _Command.Parameters.AddWithValue("@EmployeeID", EmployeeID1)
        _Command.Parameters.AddWithValue("@EmployeeID2", EmployeeID2)
        _Command.Parameters.AddWithValue("@RecordDate1", RecordDate1)
        _Command.Parameters.AddWithValue("@RecordDate2", RecordDate2)

        _Connection.Open()


        _dataAdapter = New SqlClient.SqlDataAdapter()

        _CommandBuilder = New SqlClient.SqlCommandBuilder(_dataAdapter)

        _dataAdapter.SelectCommand = _Command

        _dataAdapter.Fill(_TimeOneDataSet)

        _ReportTotalTime = New ReportDocument

        _ReportTotalTime.Load(ReportPath)

        _ReportTotalTime.SetDataSource(_TimeOneDataSet)

        CrystalReportViewer1.ReportSource = _ReportTotalTime

Answer : Stored Procedure not working in Crystal

Finally, I solve the problem.

The answer is, I should add which table in my dataset I will use as a datasource to my crystal report document.

_ReportTotalTime.SetDataSource(_TimeOneDataSet.Tables(1))

Below is the complete and working code.
Random Solutions  
 
programming4us programming4us