What is the cause of the following preview to not work. I still get 100 records, not 20:
protected void Page_Load(object sender, EventArgs e)
{
if (Page != null)
{
string keyValue = Page.Request.QueryString.Get("stimulsoft_webdesigner");
if (!IsPostBack && keyValue == null)
{
StiSqlDatabase sti_db = new StiSqlDatabase("My_Data", "Data Source=(local);Initial Catalog=MyDB;Integrated Security=True;");
swdRepDesigner.Report.Dictionary.Databases.Clear();
swdRepDesigner.Report.Dictionary.Databases.Add(sti_db);
StiSqlSource sti_src = new StiSqlSource("My_Data", "Emps", "Emps", "select top 100 * from employees;", true);
swdRepDesigner.Report.Dictionary.DataSources.Clear();
swdRepDesigner.Report.Dictionary.DataSources.Add(sti_src);
swdRepDesigner.Report.Dictionary.Synchronize();
sti_src.FillColumns();
swdRepDesigner.Design();
}
}
}
protected void swdRepDesigner_GetPreviewDataSet(object sender, StiWebDesigner.StiPreviewDataSetEventArgs e)
{
DataSet ds = new DataSet();
using (SqlConnection cn = new SqlConnection("Data Source=(local);Initial Catalog=MyDB;Integrated Security=True;"))
{
cn.Open();
using (SqlDataAdapter ad = new SqlDataAdapter("select top 20 * from employees;", cn))
{
ad.Fill(ds);
}
}
ds.Tables[0].TableName = "Emps";
e.PreviewDataSet = ds;
}
If, instead, I try to alter e.Report.DataSources (i.e. StiSqlSource sti_src = new StiSqlSource("My_Data", "Emps", "Emps", "select top 20 * from employees;", true); swdRepDesigner.Report.Dictionary.DataSources.Clear(); swdRepDesigner.Report.Dictionary.DataSources.Add(sti_src);), then I get an error.
How should this be handled?
Preview Not Working As Expected
Preview Not Working As Expected
Hello,
Before data registration for preview, please try to remove all database connections:
Thank you.
Before data registration for preview, please try to remove all database connections:
Code: Select all
protected void swdRepDesigner_GetPreviewDataSet(object sender, StiWebDesigner.StiPreviewDataSetEventArgs e)
{
e.Report.Dictionary.Databases.Clear();
.....
Preview Not Working As Expected
I did that, but now I'm not getting anything in the preview with the following:
protected void swdRepDesigner_GetPreviewDataSet(object sender, StiWebDesigner.StiPreviewDataSetEventArgs e)
{
e.Report.Dictionary.Databases.Clear();
DataSet ds = new DataSet();
using (SqlConnection cn = new SqlConnection("Data Source=(local);Initial Catalog=MyDB;Integrated Security=True;"))
{
cn.Open();
using (SqlDataAdapter ad = new SqlDataAdapter("select top 20 * from employees;", cn))
{
ad.Fill(ds);
}
}
ds.Tables[0].TableName = "Emps";
e.PreviewDataSet = ds;
}
I have verified that ds.Tables[0] contains 20 rows, as it should.
protected void swdRepDesigner_GetPreviewDataSet(object sender, StiWebDesigner.StiPreviewDataSetEventArgs e)
{
e.Report.Dictionary.Databases.Clear();
DataSet ds = new DataSet();
using (SqlConnection cn = new SqlConnection("Data Source=(local);Initial Catalog=MyDB;Integrated Security=True;"))
{
cn.Open();
using (SqlDataAdapter ad = new SqlDataAdapter("select top 20 * from employees;", cn))
{
ad.Fill(ds);
}
}
ds.Tables[0].TableName = "Emps";
e.PreviewDataSet = ds;
}
I have verified that ds.Tables[0] contains 20 rows, as it should.
Preview Not Working As Expected
I've got a more complicated project with this same code in it. It doesn't work there, either, but in that project I'm finding that the GetPreviewDataSet event is firing twice when the Preview tab is clicked. Why might that happen?
Preview Not Working As Expected
Hello,
Please send us sample project with data which reproduses the issue for analisys on support@stimulsoft.com
Thank you.
Please send us sample project with data which reproduses the issue for analisys on support@stimulsoft.com
Thank you.