Multiple Stored Procedures in CR

  • Thread starter Thread starter daniel_27
  • Start date Start date
D

daniel_27

hi. im just 'new' in .Net and currently using CR in creating reports..i have
a problem in one of my crystal reports. i have 4 stored procedures in my CR..
im using datatable in filling the report. actually, I have no problem when
dealing/populating a report that contain only 1 SP. here is my function in
populating a regular (1 SP) CR:

Public Function SetDataTable(ByVal strSP_Name As String, _
ByVal strParamName() As String, _
ByVal strParamValue() As String, _
ByVal strParamType() As DbType) As
DataTable

Dim objDataSet As DataSet
Dim adpSql As SqlDataAdapter

Try
If rptConnect() Then
Dim sql_cmd_EMP As New SqlClient.SqlCommand

sql_cmd_EMP.Connection = sqlConn
sql_cmd_EMP.CommandType = CommandType.StoredProcedure
sql_cmd_EMP.CommandTimeout = 60000
sql_cmd_EMP.CommandText = strSP_Name

SqlClient.SqlCommandBuilder.DeriveParameters(sql_cmd_EMP)

Dim cmdp_New As SqlParameter
Dim i As Integer

For i = 0 To UBound(strParamName)
For Each cmdp_New In sql_cmd_EMP.Parameters
If cmdp_New.ParameterName = strParamName(i) Then
cmdp_New.Value = strParamValue(i)
cmdp_New.DbType = strParamType(i)
Exit For
End If
Next
Next

adpSql = New SqlDataAdapter
objDataSet = New DataSet
sql_cmd_EMP.Connection = sqlConn
adpSql.SelectCommand = sql_cmd_EMP
adpSql.Fill(objDataSet)
Return objDataSet.Tables(0)
'Return True
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
'Return False
Finally
Call rptClose()
End Try
End Function

then i'll just set the report datasource in the datatable that the function
will return
rpt = New rpt_NameOfTheReport
rpt.SetDataSource(dtReport)
CrystalReportViewer1.ReportSource = rpt

but i dont know how to deal in multiple stored proc. can someone help me. i
just dont know how to figure out what to do. many thanks...
 
Hey,

Can you please clarify what you are doing in 4 SP call ?

You could have made one SP which in turn call this 4 SPs and return DataTable.
This DataTable you could have bind to CR report.
 
Back
Top