Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- From: rmails@xxxxxxxxxxxxxxx
- Date: Mon, 30 Jul 2007 02:22:42 -0700
actually i don't know that. It at least behaves like that on pocket pc
2003 and windows ce 5 devices. And also in the emulator.
On the desktop site the application is using MS Access. So I couldn't
test it there.
If it's really necessary to know I could perform the tests on the
desktop site tomorrow.
On 29 Jul., 22:05, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@xxxxxxxxxxxxxx> wrote:
Ok here's a different question - does it always happen that way? Do you get
the same result on the desktop compared with on a device? I agree the
behavior is surprising.
--
Ginny
<rma...@xxxxxxxxxxxxxxx> wrote in message
news:1185733947.603157.33330@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
No, the changing of the data doesn't result in a position changing of
the records.
This behaviour even appears if i don't change any data at all (as in
the example given above... no data are changed at all. the
sqlceresultset is opened and I apply exactly the above written
commands).
On 29 Jul., 18:59, "Ginny Caughey [MVP]"
<ginny.caughey.onl...@xxxxxxxxxxxxxx> wrote:
Does the change to the underlying data result in the current position of
the
record changing? If so, that might explain the behavior, since
ReadAbsolute
reads the original position of the data rather than the new position.
From
the docs:
This method reads the value of the row based on the row position saved by
a
bookmark. For example, suppose you have a table with 10 rows, and you
open
two ResultSets: rs1 and rs2. You call ReadAbsolue(5) on rs1 and change
the
value of this row to -1. The row's position has now changed to the first
position in the list of rows, and row 4 is in the 5th position. However,
if
you now call ReadAbsolute(5) on rs2, a value of -1 is returned. ResultSet
rs2 maintains a bookmark to the original 5th row and continues to read
that
row, despite its position changing.
--
Ginny
<rma...@xxxxxxxxxxxxxxx> wrote in message
news:1185660297.160163.149020@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hi
I finally was able to track back some strange behaviour in an
application i've wrote.
In my program i use a sqlCeResultSet for accessing my data. For doing
a refresh (when the underlying data changed), i do a
readAbsolute(currentPosition);
When i execute a readPrevious() afterwards, the resultset stays at the
same record. Only after executing the readPrevious a second time it
moves one record back...
The error happened with sql server mobile edition 3.0 so i update to
sql server compact edition 3.1, but the error still appears. The error
doesn't seem to appear with the last record of the resultset, but i
didn't completly test it out...
with following code i can reproduce the error:
SqlCeResultSet _table;
/* open a result set, with ResultSetOptions.Scrollable |
ResultSetOptions.Updatable | ResultSetOptions.Sensitive*/
_table.ReadAbsolute(10);
test = _table.GetInt32(4); // returns the primary key; test = 20
_table.ReadPrevious(); // this one works
test = _table.GetInt32(4); // test = 15
_table.ReadAbsolute(9); //reread current record
test = _table.GetInt32(4); // test = 15
_table.ReadPrevious(); // this one doesn't work
test = _table.GetInt32(4); // test = 15
_table.ReadPrevious(); // works again
test = _table.GetInt32(4); // test = 13
for me that seems to be a bug in the sql server compact edition.
Or is there anything i could have done wrong?
.
- Follow-Ups:
- Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- From: Ginny Caughey [MVP]
- Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- References:
- sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- From: rmails
- Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- From: Ginny Caughey [MVP]
- Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- From: rmails
- Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- From: Ginny Caughey [MVP]
- sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- Prev by Date: Re: Secure data in SQL Server 2005 Mobile Edition
- Next by Date: Re: Secure data in SQL Server 2005 Mobile Edition
- Previous by thread: Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- Next by thread: Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)
- Index(es):
Relevant Pages
|
Loading