[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Changing DataSource

Posted on 2004-11-02
12
Medium Priority
?
340 Views
Last Modified: 2008-01-16
I've a number of reports that are currently held on the local database server using OleDB ADO.

Now I need to be to tell each report, at run-time, to go get their data from an identical database but which is on a different server. What is the best way to do this ? Alternatively would it be better to keep a copy of the report locally on each server pointing at their own local database and load the reports remotely ?
Thanks
0
Comment
Question by:CliffordEvans
  • 5
  • 5
  • 2
12 Comments
 
LVL 10

Expert Comment

by:ebolek
ID: 12475612
you can write a small application and set  the db and server information runtime. If you need help with coding I can help you. what version crytsal, what language u can wriite app with you have to answer us first
0
 

Author Comment

by:CliffordEvans
ID: 12475639
Crystal 10
VB.NET
Thanks
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12475665
You dont like my c# codes though :)
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 101

Expert Comment

by:mlmcc
ID: 12475883
0
 

Author Comment

by:CliffordEvans
ID: 12476354
mlmcc - agree it is useful but can't find a relevant example.
ebolek - C# is fine - I can convert it.
0
 
LVL 10

Accepted Solution

by:
ebolek earned 1600 total points
ID: 12476536
here you go

internal static void SetConnection(ref ReportDocument report, string serverName, string databaseName)
            {
                  try
                  {
                        CrystalDecisions.Shared.TableLogOnInfo MyLogonInfo;
                        foreach(CrystalDecisions.CrystalReports.Engine.Table MyTable in report.Database.Tables)
                        {
                   
                              MyLogonInfo = MyTable.LogOnInfo;
                              if (MyTable.Name == "")
                              {
                                    MyLogonInfo.ConnectionInfo.ServerName  = serverName;
                                    MyLogonInfo.ConnectionInfo.DatabaseName = databaseName;
                                    MyLogonInfo.ConnectionInfo.UserID = ""; //in integrated security, this is problem.
                                    MyLogonInfo.ConnectionInfo.Password  = "";      //it works when it is not changed
                              }
                              else
                              {                  
                              
                                     
                                    MyLogonInfo.ConnectionInfo.ServerName  = serverName;
                                    MyLogonInfo.ConnectionInfo.DatabaseName = databaseName;
                                    //MyLogonInfo.ConnectionInfo.AllowCustomConnection  = true;
                                    MyLogonInfo.ConnectionInfo.UserID  = "";
                                    MyLogonInfo.ConnectionInfo.Password = "";                              
                                     
                              }
                              MyTable.Location = MyTable.Location.Substring(MyTable.Location.LastIndexOf(".")+1);
                              MyTable.ApplyLogOnInfo(MyLogonInfo);            
                                
                        }                        
                  }
                  catch( Exception logonInfoException )
                  {
                        throw logonInfoException;
                  }
            }
            /// <summary>
            /// Gets the server name currently used in the application from the configuration manager  
            /// </summary>
            /// <returns></returns>
            ///
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 12479151
I don't have VB.Net so I haven't looked at that link in much detail.

mlmcc
0
 

Author Comment

by:CliffordEvans
ID: 12554557
ebolek,
Do have have code available to do this in VB6 too ?
Thanks
0
 

Author Comment

by:CliffordEvans
ID: 12554869
Just realised it is very similar to .NET.
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12554893
I dont have vb code. Other experts might have it but the main iodea is the same. If you understand how to do it, it is a matter of time to write it in another language

regards
Emre
0
 
LVL 10

Expert Comment

by:ebolek
ID: 12555085
Glad I could help

Regards
Emre
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

640 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question