I created Stock Management System using c# and SQL Server Management Studio. In my system have crystal reports. when I run my project on client machine. its work as expected. but I cannot open crystal report. The reason is given path is not same with the client machine path.
reportDocument.Load(@"E:\Projects\WCC-StockManagementSystem\WCC-StockManagementSystem\Reports\InvoiceReport.rpt");
I want to run my crystal reports without giving full path. I want to change above line like this.
reportDocument.Load(@"WCC-StockManagementSystem\WCC-StockManagementSystem\Reports\InvoiceReport.rpt");
But if I do it like this. Its not working. Can you please tell me how to solve this problem. this is my full code for loading crystal report.
reportDocument.Load(@"E:\Projects\WCC-StockManagementSystem\WCC-StockManagementSystem\Reports\InvoiceReport.rpt");
using (SqlConnection con = new SqlConnection(CS))
{
DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter("select MAX(InvoiceNo) InvoiceNo, MAX(Cashier) Cashier, ItemName, Sum(Quantity) Quantity, ItemCode, MAX(DiscountPrice) DiscountPrice, MAX(Amount) Amount, MAX(GrossAmount) GrossAmount, MAX(Cash) Cash, MAX(Balance) Balance, MAX(NoOfItems) NoOfItems from tblTemporaryInvoice group by ItemCode, ItemName ", con);
DataTable dt = new DataTable();
sda.Fill(dt);
reportDocument.SetDataSource(dt);
crvInvoiceReportViewer.ReportSource = reportDocument;
}
Please change this code and send me right way to run crystal report on client machine. Thank you