Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Change Server at run time Post Reply Post New Topic
Author Message
snufse
Newbie
Newbie


Joined: 19 Mar 2008
Location: United States
Online Status: Offline
Posts: 36
Quote snufse Replybullet Topic: Change Server at run time
    Posted: 29 Apr 2009 at 1:04pm
We have an app where user selects a site code. Remote sites have the same data base name but the server name is diffrenet. Using crystal report viewer to show report. Now, how can a dynamically change server name at run time?
 
Can I do something like this?
 

Try

Dim myTable As CrystalDecisions.CrystalReports.Engine.Table

Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo

myCrystalReport1.Load(myPath)

For Each myTable In myCrystalReport1.Database.Tables

myLogin = myTable.LogOnInfo

myLogin.ConnectionInfo.ServerName = myAdsIPAdress

myLogin.ConnectionInfo.DatabaseName = "C:\Program Files\Astec Industries\WM2000\Data\WM2000DATA.add"

myLogin.ConnectionInfo.UserID = "xxx"

myLogin.ConnectionInfo.Password = "yyy"

myTable.ApplyLogOnInfo(myLogin)

Next

myCrystalReport1.SetParameterValue("Ask-Date", DropDownList2.SelectedValue)

CrystalReportViewer1.ReportSource = myCrystalReport1

CrystalReportViewer1.Zoom(90)

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.