View Single Post
  #1 (permalink)  
Old April 14th, 2004, 09:56 PM
msrnivas msrnivas is offline
Friend of Wrox
Join Date: Sep 2003
Location: , , .
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default Windows Authentication prob pl help

I am working on crystall reports in try to connect my local sqlserver using sa account my report is working fine.
When i try connect anothe sql server (which is reside on some other machine) using window authentication i am getting invalid table number error.When i debug my code its giving error at CrTable.Location i am giving my code pl pl help me.


Dim rptAttendance As New ReportDocument
Dim strDBServer As String
Dim strDBName As String
Dim strUserName As String
Dim strPassword As String
Dim strReportFilePath As String
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter

Dim crReportDocument As New ReportDocument
strReportFilePath = Request.MapPath("").ToString
strReportFilePath = strReportFilePath & "\" & "test2.rpt"

strDBServer = "Acc"
strDBName = "Sales"

With crConnectionInfo
.ServerName = strDBServer
.DatabaseName = strDBName
End With

CrTables = crReportDocument.Database.Tables

'Loop through each table in the report and apply the
'LogonInfo information

For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.Location = strDBName & ".dbo." & CrTable.Location.Substring (CrTable.Location.LastIndexOf(".") + 1)
CrystalReportViewer1.DisplayToolbar = True
CrystalReportViewer1.DisplayPage = True
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.ReportSource = crReportDocument