Error in in asp.net crystal report :the data at the root level is invalid line 1 position 1

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
i want to view the records from between two dates if click Button. want to display records between two dates.but when i click button showing error like " the data at the root level is invalid line 1 position 1 ".. plz solve this problem give me a right solution
for this problem plz....
im using two parameters in parameter field. parameter formula :
SelectionFormula="{TT_DAILYCUMOP.DOCDATE} >= {?fromDate} and {TT_DAILYCUMOP.DOCDATE} <= {?toDate}"

Thanks Advance

My code:

private void Button1_Click(object sender, System.EventArgs e)<br/>
{<br/>
<br/>
try<br/>
<br/>
{<br/>
<br/>
this.CrystalReportViewer1.Visible = true;<br/>
ReportDocument cryRpt = new ReportDocument();<br/>
cryRpt.Load("C:/Inetpub/wwwroot/iHenz/contents/feed/common/Accounts/Reports/frmCrystalReport1.rpt");<br/>
<br/>
<br/>
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();<br/>
<br/>
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();<br/>
<br/>
ConnectionInfo crConnectionInfo = new ConnectionInfo();<br/>
<br/>
Tables CrTables;<br/>
<br/>
<br/>
<br/>
ParameterFieldDefinitions crParameterFieldDefinitions ;<br/>
<br/>
ParameterFieldDefinition crParameterFieldDefinition ;<br/>
<br/>
ParameterValues crParameterValues = new ParameterValues();<br/>
<br/>
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();<br/>
<br/>
<br/>
<br/>
crParameterDiscreteValue.Value = TextBox1.Text;<br/>
<br/>
TextBox1.Text = Convert.ToString(string.Format("{0:MM/dd/yyyy}"));
<br/>
<br/>
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;<br/>
<br/>
crParameterFieldDefinition = crParameterFieldDefinitions["fromDate"];<br/>
<br/>
crParameterValues = crParameterFieldDefinition.CurrentValues;<br/>
<br/>
<br/>
<br/>
crParameterValues.Clear();<br/>
<br/>
crParameterValues.Add(crParameterDiscreteValue);<br/>
<br/>
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);<br/>
<br/>
<br/>
<br/>
crParameterDiscreteValue.Value = TextBox2.Text;<br/>
<br/>
TextBox2.Text = Convert.ToString(string.Format("{0:MM/dd/yyyy}"));
<br/>
<br/>
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;<br/>
<br/>
crParameterFieldDefinition = crParameterFieldDefinitions["toDate"];<br/>
<br/>
crParameterValues = crParameterFieldDefinition.CurrentValues;<br/>
<br/>
<br/>
<br/>
crParameterValues.Add(crParameterDiscreteValue);<br/>
<br/>
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);<br/>
<br/>
<br/>
<br/>
crConnectionInfo.ServerName = "ITECHdb";<br/>
<br/>
crConnectionInfo.DatabaseName = "ITECHdb";<br/>
<br/>
crConnectionInfo.UserID = "itechlap";<br/>
<br/>
crConnectionInfo.Password = "itechlap";<br/>
//cryRpt.Load(Server.MapPath ("frmCrystalReport1.rpt"));<br/>
<br/>
<br/>
<br/>
CrTables = cryRpt.Database.Tables;<br/>
<br/>
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)<br/>
<br/>
{<br/>
<br/>
crtableLogoninfo = CrTable.LogOnInfo;<br/>
<br/>
crtableLogoninfo.ConnectionInfo = crConnectionInfo;<br/>
<br/>
CrTable.ApplyLogOnInfo(crtableLogoninfo);<br/>
<br/>

<br/>
}<br/>
CrystalReportViewer1.ReportSource = cryRpt;<br/>
this.CrystalReportViewer1.ReportSource = Server.MapPath ("frmCrystalReport1.rpt");<br/>
<br/>
CrystalReportViewer1.RefreshReport ();<br/>
<br/>
}<br/>
<br/>
catch (Exception ex)<br/>
<br/>
{<br/>
<br/>
//string script = "<script>alert(" + ex.Message + ");</script>";<br/>
Response.Write (ex.Message );<br/>

<br/>
<br/>
}<br/>
<br/>
<br/>
<br/>
}<br/>
<br/>


View the full article
 
Back
Top