Kevin,
Thanks for the reply! Since the root of my app revolves around the
DataGrid, I think I am sorta stuck with the DataSet to populate it.
Essentially the root of the app is to display a subset of X data in a
datagrid, and cycle through it in a prescribed order and display the full X
data in a seperate form each time we cycle to a new row in the DataGrid.
However, I am using the DataSet, with several DataViews, as a central in
memory repository for the data I'm currently manipulating and do not want to
write it back to the database, if at all, until sometime much later in the
process. As the code is sorta long and evolved, I won't post it here
(although I could send you the project privately if that'd help), however
here is the basic semi-psuedo-code synopsis of it:
Create DataSet
Create DataAdapter
Assign SELECT SQL: select X from Y, X, Z where Y = X, X=Z
Create DataView for DataGrid with sorting
Create DataView for Singular viewing of a record
Attach DataView for DataGrid to DataGrid
Attach DataView for Singular to Display Form with controls
Populate DataSet
At this point I have my data displayed in the DataGrid, however I wish to be
able to fetch values from row/columns from the DataSet and even update them.
This is where it is very slow in doing so. Essentially when getting and
setting from the DataSet, I do the following:
get:
value = DataTable.Rows.Find(PrimaryKey)[Key];
set:
DataTable.Rows.Find(PrimaryKey)[Key] = value;
I do some "caching" so that if the last row accessed is the same as the
current row needing to be accessed, I don't have to do the Rows.Find.
I would have thought that this would be a fairly fast operation because the
DataSet is supposed to reside in memory and be disconnected from the
Database. I should note that I've only doing the find on Primary Keys, and
haven't set up any other indexes in the DataSet.
On a similiar note, there seems to be a native exception being thrown when a
DataGrid's datasource points to a DataView that has a sort on it. If you
modify a value in the column being sorted on, it can sometimes lead to a
native exception. You can get around this by setting the DataView's sort
to default performing any updates to the columns and resorting, but this is
much slower.
Thanks for the response!!
"Kevin Boske - [MS]" said:
Hi Hollywood,
The DataSet is not as fast as directly using the database. There are a
number of factors. The DataSet has to keep a copy of the data in memory.
It must also recompile any queries that are run, unlike the SQL Server CE
engine. If possible, you should use the DataReader() instead.
Also, it takes time to populat the DataGrid.
Please post a snippit of your code.
Kevin Boske
(
[email protected])
SQL Server CE Team
Microsoft
-------------------------------------------------------------------------- --
----------------------------------------
Everything you need to know about SQL Server CE:
http://www.microsoft.com/sql/ce/techinfo/default.asp
-------------------------------------------------------------------------- --
----------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
-------------------------------------------------------------------------- --
----------------------------------------
--------------------
From: "Hollywood" <
[email protected]>
References: <#
[email protected]>
Subject: Re: DataSet Fetch/Update speed
Date: Thu, 24 Jul 2003 10:21:32 -0500
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.dotnet.framework.compactframework
NNTP-Posting-Host: adsl-68-22-127-62.dsl.chcgil.ameritech.net 68.22.127.62
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:29118
X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
Anything at all?
Hollywood said:
Yes, I am attempting to use a DataSet with one DataTable to manage data in
memory from a SQLServerCe data adapter. The DataTable is defined by a
select statement that includes several joins (since the DataGrid control
only supports reading from one table... the DataGrid however is fed by
another DataView other than the DefaultView). However, when I attempt to
get or set explicit pieces of data in the DataSet via the DataTable, i.e.
dataset.Tables["myTable"].Rows["myRow"][0], it takes roughly a second to
complete the operation. My understanding was that the DataSet was all in
memory and that it does not update the database until the AcceptChanges
method is called. To me this means that data access with the DataSet should
be very fast. Am I missing something?
Thanks!