I'v developed an application.which works very fine on my pc. I havent done any hardcode there. I Have following code on my crystel reportviewer
private void crystalReportViewer1_Load(object sender, EventArgs e)
{
HMSCon=new HMSConnection();
connectionString = HMSCon.cn.ConnectionString;
builder = new SqlConnectionStringBuilder(connectionString);
password = builder.Password;
username = builder.UserID;
dataSource = builder.DataSource;
initialCatalog = builder.InitialCatalog;
myTBInfo = new TableLogOnInfo();
myTBInfos = new TableLogOnInfos();
myConn = new ConnectionInfo();
myConn.ServerName = dataSource;
myConn.DatabaseName = initialCatalog;
myConn.Password = password;
myConn.UserID = username;
myTBInfo.ConnectionInfo = myConn;
myTBInfos.Add(myTBInfo);
crystalReportViewer1.LogOnInfo = myTBInfos;
try
{
report = new FinalBillLodgingAndServices();
Lodgingreport = new FinalLodgingReportBill();
Servicereport = new FinalServiceBill();
String[] arrlis = (String[])RoomList.ToArray(typeof(string));
String[] servarrlis = (String[])ServiceroomsList.ToArray(typeof(string));
report.SetParameterValue("BookingId", bkinid);
report.SetParameterValue("RoomNames", arrlis);
report.SetParameterValue("BillStatus", "Paid");
report.SetParameterValue("LodgingPaybale", LodgingPayble);
report.SetParameterValue("AmountInWord", NetAmountINword);
report.SetParameterValue("PaybleServiceAmount", ServiceAmount,"FinalBillRoomServiceSubreport");
report.SetParameterValue("Rooms", servarrlis, "FinalBillRoomServiceSubreport");
crystalReportViewer1.ReportSource = report;
crystalReportViewer1.Refresh();
}
catch(Exception ex)
{
MessageBox.Show(""+ex);
}
}
but when i try to run that application on other pc it needs to set datasource location. and i need to rplace sql server name every time ..is der any way to open crystel report without seting this.
------------- Develope the unique
|