Re: sqlCeResultSet readPrevious() method doesn't work always after a readAbsolut(currentPosition)



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?


.



Relevant Pages

  • Re: sqlCeResultSet readPrevious() method doesnt work always after a readAbsolut(currentPosition)
    ... On the desktop site the application is using MS Access. ... sqlceresultset is opened and I apply exactly the above written ... When i execute a readPreviousafterwards, the resultset stays ...
    (microsoft.public.sqlserver.ce)
  • Re: recordset not opening even though query analyzer returns resul
    ... I'm convinced that VB can execute this complex SP. ... > only way i could get an earlier version of it to return in a recordset. ... > table into a cursor and add up th evalues of the ccjs based on values in ... >> execute a query the SQL engine returns a resultset. ...
    (microsoft.public.vb.database.ado)
  • Re: sqlCeResultSet readPrevious() method doesnt work always after a readAbsolut(currentPosition)
    ... Do you know if there is some kind of form or similar to make a bug ... On the desktop site the application is using MS Access. ... sqlceresultset is opened and I apply exactly the above written ... When i execute a readPreviousafterwards, the resultset stays at ...
    (microsoft.public.sqlserver.ce)
  • Re: jdbc query
    ... resultset is not getting executed. ... You can use the execute around idiom to tidy this lot up: ... final EmployerTeam employerTeam ... throws SQLException { ...
    (comp.lang.java.programmer)
  • Re: running complete transactions
    ... the resultset is retrieved from the first select statement, ... --into tableB or tableC before these next two select statements have ... I would be grateful if you could tell me if I have understood the API ... then execute a number of ResultSet ...
    (comp.lang.java.databases)

Loading