DataSet binding problem
DataSet binding problem
Hello,
Could you, please send us the full source code of your web project, because the part you showed is not enough to understand where is the "informe" report taken from and why are data registered in the "re" report.
Thank you.
Could you, please send us the full source code of your web project, because the part you showed is not enough to understand where is the "informe" report taken from and why are data registered in the "re" report.
Thank you.
DataSet binding problem
ok, sorry.
Now I have an aspx page with a StiWebDesigner control and a button who calls the designer.
In the code file (. Cs) I have only the button´s event, nothing else.
Nothing in the "Page_Load".
The code I wrote belongs entirely to button´s event.
Thanks for replying so fast.
Now I have an aspx page with a StiWebDesigner control and a button who calls the designer.
In the code file (. Cs) I have only the button´s event, nothing else.
Nothing in the "Page_Load".
The code I wrote belongs entirely to button´s event.
Code: Select all
protected void Button1_Click(object sender, EventArgs e)
{
StiReport re= new StiReport();
DataSet data= new DataSet();
bussinesAD bussines= new bussinesAD();
data= bussines.getBussinesID(2);
re.RegData(data);
string connString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Proyects Rodrigo\\GesRes.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
StiSqlDatabase database = new StiSqlDatabase(data.DataSetName,connString);
re.Dictionary.Databases.Clear();
re.Dictionary.Databases.Add(database);
re.Dictionary.Synchronize();
StiWebDesigner1.Design(re);
}
DataSet binding problem
Hello,
Your code is correct, but it only creates a connection to the database. To see the data sources, they also should be created. The best way to do this is with the report designer, but also you can it by code:
StiSqlSource ds = new StiSqlSource("Database.Table1", "Table1", "SELECT * FROM Table1");
re.Dictionary.DataSources.Add(ds);
ds.SynchronizeColumns();
Thank you.
Your code is correct, but it only creates a connection to the database. To see the data sources, they also should be created. The best way to do this is with the report designer, but also you can it by code:
StiSqlSource ds = new StiSqlSource("Database.Table1", "Table1", "SELECT * FROM Table1");
re.Dictionary.DataSources.Add(ds);
ds.SynchronizeColumns();
Thank you.
DataSet binding problem
ok, thanks for your answer, I will put it into practice.
But if my code is correct ... the problem is in the StiWebDesigner? I do not understand why I can not see the preview of the report :S
Thank you.
But if my code is correct ... the problem is in the StiWebDesigner? I do not understand why I can not see the preview of the report :S
Thank you.
DataSet binding problem
Hello,
There are two ways to preview a report that would work correctly:
1. Add a new connection to the database, as we have shown above.
2. Connect data directly to the report in the GetPreviewDataSet event:
Thank you.
There are two ways to preview a report that would work correctly:
1. Add a new connection to the database, as we have shown above.
2. Connect data directly to the report in the GetPreviewDataSet event:
Code: Select all
protected void StiWebDesigner1_GetPreviewDataSet(object sender, StiWebDesigner.StiPreviewDataSetEventArgs e)
{
string appDirectory = HttpContext.Current.Server.MapPath(string.Empty);
DataSet data = new DataSet();
data.ReadXml(appDirectory + "\\Data\\Demo.xml");
data.ReadXmlSchema(appDirectory + "\\Data\\Demo.xsd");
e.PreviewDataSet = data;
}
DataSet binding problem
Perfect!!!
Now it works perfectly.
Thank you very much.
Now it works perfectly.
Thank you very much.
DataSet binding problem
Great! :biggrin: