Print Page | Close Window

using stored procedure (crystal report/asp.net 1.1

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Writing Code
Forum Discription: .NET 2003 programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4586
Printed Date: 27 Apr 2024 at 9:12pm


Topic: using stored procedure (crystal report/asp.net 1.1
Posted By: yasinirshad
Subject: using stored procedure (crystal report/asp.net 1.1
Date Posted: 20 Oct 2008 at 11:24pm

Hi,
Am getting this below error.
Error in File file://\\nb888p\Proj\Report\ABC.rpt - \\nb888p\Proj\Report\ABC.rpt : Invalid table number.

I am having 10 reports all work fine except one which is using one stored procedure.
I am using CR 8.5, asp.net 2003. I am trying to load report in my project which was designed by someone else.

On my CR, when i check Database -> Set Location , it has under 'Databases' one table and one stored procedure ,i.e.,
myDB.dbo.chn_2008 - which is table
myDB.dbo.Proc(cmp_Total;1) - which is stored procedure.


Below is my code.
Am getting error here -->dt.Location = "myDB.dbo.Proc(cmp_Total;1)"
{code}
Try
            Dim crReportDocument As New ReportDocument
            crReportDocument.Load(gbVariables.strDocPathFolder + "\" + "ABC.rpt")
            Dim myLogin As TableLogOnInfo
            Dim strTableName As String
            Dim subRpt As ReportDocument
            If Not crReportDocument Is Nothing Then
                myLogin = New TableLogOnInfo
                With myLogin.ConnectionInfo
                    .ServerName = "Sname"
                    .UserID = "uid"
                    .Password = "pwd"
                    .DatabaseName = "myDB"
                End With
                Dim dt As Table
                For Each dt In crReportDocument.Database.Tables
                    With dt
                        dt.ApplyLogOnInfo(myLogin)
                        dt.Location = "myDB.dbo.Proc(cmp_Total;1)" ---> error here
                    End With
                Next
            End If

            Me.CrystalReportViewer1.ParameterFieldInfo.Clear()
            Dim ParamFields As ParameterFields = Me.CrystalReportViewer1.ParameterFieldInfo

            'Set Month Paramter
            Dim GetMonthValues As Int16
            GetMonthValues = Session("Month")
            Dim Per As New ParameterField
            Per.ParameterFieldName = "@Month"
            Dim Month_Value As New ParameterDiscreteValue
            Month_Value.Value = GetMonthValues
            Per.CurrentValues.Add(Month_Value)
            ParamFields.Add(Per)

            Me.CrystalReportViewer1.ParameterFieldInfo = ParamFields
            Me.CrystalReportViewer1.ReportSource = crReportDocument           
            Me.CrystalReportViewer1.RefreshReport()
            Me.CrystalReportViewer1.Visible = True
        Catch ex As Exception
            lblError.Text = ex.Message.ToString
        End Try
{code}
Thanks to help...



-------------
Thanks,
Yasin.



Print Page | Close Window