-Help- Setting Crystal Reports.Net Database Location 
Author Message
 -Help- Setting Crystal Reports.Net Database Location

Our company is in midst of developing a large ERP project for a
reputed firm, and have tons and tons of reports developed using Cystal
Reports.Net. The problem we are facing that we currently have three
servers, one development server, one test server and one
implementation server.

The reports are created on the development server and then ported to
the test server for unit testing. Since the test server's SQL Server
instance's name is different fromt the test server, previously we had
to change the database location for each report using Set Location
context menu of each report. That would take a huge chunk of time out
of develpment.

Recently, we switched setting the location of the reports using a
ReportLocation class that would call this code..

Public Shared Sub Export(ByVal Rpt As ReportClass, ByVal Filter As
String,ByVal FormCode As String, ByVal CpnyCode As String, ByVal
Comments As String)
            Try
                Dim Names As New EKSNames()
                Dim Cntxt As HttpContext = HttpContext.Current
                Dim tbl As
CrystalDecisions.CrystalReports.Engine.Table
                Dim db As
CrystalDecisions.CrystalReports.Engine.Database
                Dim tbll As New
CrystalDecisions.Shared.TableLogOnInfo()
                Dim AppS As ConfigurationSettings
                Dim i As Integer

                With Rpt
                    .SummaryInfo.ReportTitle =
Names.FormName(FormCode)
                    .SummaryInfo.ReportComments =
Names.CompanyName(CpnyCode) & Comments

                    .RecordSelectionFormula = Filter

                    tbll.ConnectionInfo.ServerName =
AppS.AppSettings.Item("ServerName")
                    tbll.ConnectionInfo.DatabaseName =
AppS.AppSettings.Item("DatabaseName")
                    tbll.ConnectionInfo.UserID =
AppS.AppSettings.Item("UserID")
                    tbll.ConnectionInfo.Password =
AppS.AppSettings.Item("Password")

                    For Each tbl In .Database.Tables
                        Try
                            tbl.ApplyLogOnInfo(tbll)
                            tbl.Location =
AppS.AppSettings.Item("DatabaseName") & ".dbo." & tbl.Name
                        Catch ex As
CrystalDecisions.CrystalReports.Engine.InvalidArgumentException

                        End Try
                    Next
                End With

                Dim fname As String =
AppS.AppSettings.Item("Report_Path") &
Cntxt.Session.SessionID.ToString & ".pdf"
                Dim destopt As New DiskFileDestinationOptions()
                destopt.DiskFileName = fname
                With Rpt.ExportOptions
                    .DestinationOptions = destopt
                    .ExportDestinationType =
ExportDestinationType.DiskFile
                    .ExportFormatType =
ExportFormatType.PortableDocFormat
                End With
                Rpt.Export()
                Cntxt.Response.Write("<script language='javascript'>
window.open('../reportforms/temp.aspx',''," &
AppS.AppSettings.Item("Report_Features") & "); </script>")

            Catch ex As
CrystalDecisions.CrystalReports.Engine.InvalidArgumentException

            End Try
        End Sub

For launching each report calling this class's Export function, which
would read the database location set int the configuration file. This
works splendidly in the development server where the reports are
initially created. But when the reports are ported to the test server,
some reports start showing the error "Failed To Open Rowset" or "Login
Failed" errors. For solving this problem we manually set the location
for each report and voila! it starts working again.

Does anyone know of a solution or workaround to this problem, cause
setting the location property for each form is A PAIN!!!!.

Thanks in advance for the help.

Ritesh Rao
System Analyst
Applied Business Applications Corp.



Wed, 31 Aug 2005 15:01:13 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How can i programmically Set Location of my database in Crystal Report of vb.net

2. crystal reports- setting database location

3. Setting Crystal Report Database Location at RunTime...

4. Crystal Report -- set location of database at run time

5. Crystal 4.6 set database location - same as database

6. Location of database for Crystal Report - HELP !!!!!!

7. Location of database for Crystal Report - HELP !!!!!!

8. Reports written in Crystal - database has moved - how can I respecify the database location

9. Crystal 9.0 problem with set datasource location (in .Net)

10. Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion

11. Crystal Reports 6 and Setting MDB File Name and Location

12. Crystal Report: How to Set Location of OLE object at Run Time

 

 
Powered by phpBB® Forum Software