Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: using stored procedure (crystal report/asp.net 1.1 Post Reply Post New Topic
Author Message
yasinirshad
Newbie
Newbie
Avatar

Joined: 24 Sep 2007
Location: Saudi Arabia
Online Status: Offline
Posts: 39
Quote yasinirshad Replybullet Topic: using stored procedure (crystal report/asp.net 1.1
    Posted: 20 Oct 2008 at 11:24pm

Hi,
Am getting this below error.
Error in File \\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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.