Hi, this is my first time to use this product.
my application can trace the save event successfully,
but when I load the report again,
it shows empty report!!!
this is my code:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
StiWebDesigner1.Report = GetReport(Request["ReportNo"]);
StiWebDesigner1.Report.ReportName = Request["ReportNo"];
StiWebDesigner1.Design();
}
}
protected void StiWebDesigner1_SaveReport(object sender, Stimulsoft.Report.Web.StiWebDesigner.StiSaveReportEventArgs e)
{
SqlConnection conn = new SqlConnection();
string connstring = ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString;
conn = new SqlConnection(connstring);
conn.Open();
string FileOutPut = "";
StiReport report = e.Report;
FileOutPut = report.SavePackedDocumentToString();
SqlCommand sc = new SqlCommand("Update Report Set ReportFile =@Pointer, ReportEditDate=" + DateTime.Now.ToShortDateString() + " WHERE (ReportNo = '" + report.ReportName + "')", conn);
SqlParameter ptrParm = sc.Parameters.Add("@Pointer", SqlDbType.VarChar);
ptrParm.Value = FileOutPut;
sc.ExecuteNonQuery();
conn.Close();
}
protected StiReport GetReport(String ReportNo)
{
SqlConnection conn = new SqlConnection();
string connstring = ConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString;
conn = new SqlConnection(connstring);
conn.Open();
string FileOutPut = "";
SqlCommand sc = new SqlCommand("SELECT ReportFile FROM Report WHERE (ReportNo = '" + ReportNo + "')", conn);
SqlDataReader mr = sc.ExecuteReader();
StiReport report = new StiReport();
if (mr.Read())
{
FileOutPut = mr["ReportFile"].ToString();
}
else
{
return null;
}
mr.Close();
report.LoadPackedDocumentFromString(FileOutPut);
SqlDataAdapter newDataAdapter = new SqlDataAdapter("Select * from myTable", conn);
DataSet newDataSet = new DataSet();
newDataAdapter.Fill(newDataSet);
//
report.RegData("myTable", newDataSet);
report.Dictionary.Connect();
conn.Close();
//report.Compile();
return (report);
}
I use the verson 2009.2,
really need your help!!
Save a report to SQL varchar(Max), but always Load a Empty Report
Save a report to SQL varchar(Max), but always Load a Empty Report
when I change the code :
report.SavePackedDocumentToString();
LoadPackedDocumentFromString(FileOutPut);
to this one:
report.SaveToString();
SavePackedDocumentFromString(FileOutPut);
the problem all clear!?
Can anyone tell me why??
report.SavePackedDocumentToString();
LoadPackedDocumentFromString(FileOutPut);
to this one:
report.SaveToString();
SavePackedDocumentFromString(FileOutPut);
the problem all clear!?
Can anyone tell me why??
Save a report to SQL varchar(Max), but always Load a Empty Report
Hello,
Please, send us a simple application example for testing to support@stimulsoft.com. It is very hard to find the problem in you code.
Thank you.
Please, send us a simple application example for testing to support@stimulsoft.com. It is very hard to find the problem in you code.
Thank you.