T
Thomas Bandt
Hi,
I am currently building a little database application for
Pocket PC with CF 2.0 and SQL Mobile 2005.
Actually I try to get a little fulltext search running. For
that I am using a SqlCeCommand object to get the data from
the database, and a User Control bound in a loop to the
database data to display each result.
Because of that I can't using automatic databinding - I have
to iterate trough a result set. And that is my problem.
To get the data from the database it takes about 2 seconds.
To iterate through the result set, takes about 16-18 seconds!
The resultset contains only 10 rows (of 26.000 in the database
table at all)!
I tried to use a SqlCeDataReader, a SqlCeResultSet and also
a DataTable (I know this uses DataReader inside) - with the
same results:
--
SqlCeDataAdapter da = new SqlCeDataAdapter(cmd);
DataTable results = new DataTable();
da.Fill(results);
duration1 = DateTime.Now - start;
for (int i = 0; i < results.Rows.Count; i++)
{
}
--> Filling the data into the DataTable ~ 16 seconds.
Looping thourgh the rows is fast, but to get the data
into the DataTable it uses a DataReader, which is slow
--
using (SqlCeResultSet rs =
cmd.ExecuteResultSet(ResultSetOptions.Insensitive))
{
duration1 = DateTime.Now - start;
while (rs.Read())
{
}
}
Get the data ~ 7 seconds. Looping ~ 13 seconds.
--
using (SqlCeDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
}
}
Get the data ~ 2 seconds, looping 18 seconds.
--
In the loop itself I do nothing, it is empty. So I
don't understand why it takes so long? And that for 10 rows?
Any idea?
I am currently building a little database application for
Pocket PC with CF 2.0 and SQL Mobile 2005.
Actually I try to get a little fulltext search running. For
that I am using a SqlCeCommand object to get the data from
the database, and a User Control bound in a loop to the
database data to display each result.
Because of that I can't using automatic databinding - I have
to iterate trough a result set. And that is my problem.
To get the data from the database it takes about 2 seconds.
To iterate through the result set, takes about 16-18 seconds!
The resultset contains only 10 rows (of 26.000 in the database
table at all)!
I tried to use a SqlCeDataReader, a SqlCeResultSet and also
a DataTable (I know this uses DataReader inside) - with the
same results:
--
SqlCeDataAdapter da = new SqlCeDataAdapter(cmd);
DataTable results = new DataTable();
da.Fill(results);
duration1 = DateTime.Now - start;
for (int i = 0; i < results.Rows.Count; i++)
{
}
--> Filling the data into the DataTable ~ 16 seconds.
Looping thourgh the rows is fast, but to get the data
into the DataTable it uses a DataReader, which is slow
--
using (SqlCeResultSet rs =
cmd.ExecuteResultSet(ResultSetOptions.Insensitive))
{
duration1 = DateTime.Now - start;
while (rs.Read())
{
}
}
Get the data ~ 7 seconds. Looping ~ 13 seconds.
--
using (SqlCeDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
}
}
Get the data ~ 2 seconds, looping 18 seconds.
--
In the loop itself I do nothing, it is empty. So I
don't understand why it takes so long? And that for 10 rows?
Any idea?