Page 1 of 1

FillColumns taking a long time

Posted: Mon Mar 07, 2011 10:51 pm
by jay@bplogix.com
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

Posted: Tue Mar 08, 2011 11:18 am
by Jan
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:

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())));
                                }
This code does not get all row from database.

Thank you.

FillColumns taking a long time

Posted: Tue Mar 08, 2011 9:32 pm
by jay@bplogix.com
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).

FillColumns taking a long time

Posted: Wed Mar 09, 2011 2:51 am
by Alex K.
Hello,

We couldn't reproduce this bug.
Please send us sample project with sample data for analysis.

Thank you.