Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: Datasource Location For crystel report Post Reply Post New Topic
Author Message
ManKhl
Newbie
Newbie
Avatar

Joined: 01 Aug 2011
Online Status: Offline
Posts: 4
Quote ManKhl Replybullet Topic: Datasource Location For crystel report
    Posted: 03 Aug 2011 at 11:26pm
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
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.031 seconds.