I am adding databases connections and datasources dynamically. I am adding a datasource using
StiSqlSource sti_src = new StiSqlSource(pDatabaseName, "MY_TABLE", "MY_TABLE", "select * from MY_TABLE;", true);
pReport.Dictionary.DataSources.Add(sti_src);
pReport.Dictionary.Synchronize();
sti_src.FillColumns();
... the sti_src.FillColumns takes 30 seconds if the MY_TABLE has a lot of rows. This takes this long even if MY_TABLE is not actually used in the report. Why does this take so long? Is this the correct way to dynamically add a SQL Server table to a report. Is there a faster way that does not actually get all the rows unless they are needed to run the report?
thx
FillColumns taking a long time
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
FillColumns taking a long time
Hello,
Its very hard to say why it work so slowly without really data from your side. We use following code to get columns from sql database:
This code does not get all row from database.
Thank you.
Its very hard to say why it work so slowly without really data from your side. We use following code to get columns from sql database:
Code: Select all
SqlCommand sqlCommand = new SqlCommand(sqlSource.SqlCommand);
sqlCommand.Connection = connection;
foreach (StiDataParameter parameter in dataSource.Parameters)
{
sqlCommand.Parameters.AddWithValue(parameter.Name, parameter.Value == null ? parameter.ParameterValue : parameter.Value);
}
sqlCommand.CommandType = CommandType.Text;
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
dataTable = sqlDataReader.GetSchemaTable();
foreach (DataRow row in dataTable.Rows)
{
dataColumns.Add(new StiDataColumn(row["ColumnName"].ToString(), row["ColumnName"].ToString(), Type.GetType(row["DataType"].ToString())));
}
Thank you.
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
FillColumns taking a long time
OK ... I see the problem now. The only tables that have this problem are the ones that have a column with an "image" (a blob).
Basically if you add a table like this to your report, and that table has 2000 or so rows, the report takes 30 seconds just to initialize ... even if the datasource is not actually used in the report!
I do not think the problem is in the code you listed ... I entered that into my project for the particular table with an image column and it was very fast. But it looks like the report engine is choking somwhere if there are any blob columns (image in SQL Server).
Basically if you add a table like this to your report, and that table has 2000 or so rows, the report takes 30 seconds just to initialize ... even if the datasource is not actually used in the report!
I do not think the problem is in the code you listed ... I entered that into my project for the particular table with an image column and it was very fast. But it looks like the report engine is choking somwhere if there are any blob columns (image in SQL Server).
FillColumns taking a long time
Hello,
We couldn't reproduce this bug.
Please send us sample project with sample data for analysis.
Thank you.
We couldn't reproduce this bug.
Please send us sample project with sample data for analysis.
Thank you.