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...