Changing DataSource

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
CliffordEvansAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ebolekCommented:
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
CliffordEvansAuthor Commented:
Crystal 10
VB.NET
Thanks
0
ebolekCommented:
You dont like my c# codes though :)
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

CliffordEvansAuthor Commented:
mlmcc - agree it is useful but can't find a relevant example.
ebolek - C# is fine - I can convert it.
0
ebolekCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlmccCommented:
I don't have VB.Net so I haven't looked at that link in much detail.

mlmcc
0
CliffordEvansAuthor Commented:
ebolek,
Do have have code available to do this in VB6 too ?
Thanks
0
CliffordEvansAuthor Commented:
Just realised it is very similar to .NET.
0
ebolekCommented:
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
ebolekCommented:
Glad I could help

Regards
Emre
0
CliffordEvansAuthor Commented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.