Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: How to change database c# 2005 Post Reply Post New Topic
Author Message
Santiago
Newbie
Newbie
Avatar

Joined: 11 Dec 2007
Location: United States
Online Status: Offline
Posts: 1
Quote Santiago Replybullet Topic: How to change database c# 2005
    Posted: 11 Dec 2007 at 2:26pm

I have a report that is atched to a database (using a store procediture) I want to change the database connection at run time, but when I change the database the parameters are not passed and viseversa. Please help me with any idea. This is the code I am using: 

(C_App is the database name I want to set up, but everytime the report grabs the default database SM_App) 
 
 
 
ReportDocument myDataReport = new ReportDocument();

myDataReport.Load("C:\\Report.rpt");

CrystalDecisions.Shared.TableLogOnInfo myInfo;

crview.LogOnInfo = new TableLogOnInfos();

myInfo = new TableLogOnInfo();

myInfo.ConnectionInfo.ServerName = "DAtabaseName";

myInfo.ConnectionInfo.DatabaseName = "C_App";

myInfo.ConnectionInfo.UserID = "sa";

myInfo.ConnectionInfo.Password = "password";

myDataReport.SetParameterValue("@parameter1", "value1");

myDataReport.SetParameterValue("@parameter2", "value2");

 

CrystalReportViewer1.LogOnInfo.Add(myInfo);

CrystalReportViewer1.ReportSource = myDataReport;

}

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.017 seconds.