I have the following code which pass data from datagridview to a xml file (stored in my device in this path: this path: C:\Users\Multi\MainPro\bin\Debug) and then display them in crystal report, the application is working fine as long as I run it from my device but it doesn't work in user device, so How can I fix this problem?
DataTable Dt = new DataTable();
Dt.Columns.Add("BrachName", typeof(string));
Dt.Columns.Add("MachNO", typeof(string));
Dt.Columns.Add("MachType", typeof(string));
Dt.Columns.Add("MachGroupName", typeof(string));
Dt.Columns.Add("MachChasiNO", typeof(string));
Dt.Columns.Add("MachFeatures", typeof(string));
Dt.Columns.Add("MachCountry", typeof(string));
Dt.Columns.Add("MachModel", typeof(int));
Dt.Columns.Add("MachIsOff", typeof(Boolean));
Dt.Columns.Add("MachIsloaning", typeof(Boolean));
Dt.Columns.Add("MachIsBorrowed", typeof(Boolean));
Dt.Columns.Add("MachNotes", typeof(string));
Dt.Columns.Add("Clarefication", typeof(string));
foreach (DataGridViewRow dgv in dgMachines.Rows)
{
Dt.Rows.Add(dgv.Cells[0].Value, dgv.Cells[1].Value, dgv.Cells[2].Value, dgv.Cells[3].Value, dgv.Cells[4].Value, dgv.Cells[5].Value, dgv.Cells[6].Value, dgv.Cells[7].Value, dgv.Cells[8].Value, dgv.Cells[9].Value,dgv.Cells[10].Value, dgv.Cells[11].Value, dgv.Cells[12].Value);
}
Ds.Tables.Add(Dt);
Ds.WriteXmlSchema("Sample.xml");
RPT.RPT_DG myreport = new RPT.RPT_DG();
myreport.SetDataSource(Ds);
RPT.FRM_Reports myform = new RPT.FRM_Reports();
myform.crystalReportViewer1.ReportSource = myreport;
myform.ShowDialog();```