General information
Category:
Coding, syntax & commands
Xavier,
Here is a reply from MS that I picked up on a newsgroup that has some similarities to your problem:
I have reported a bug to MS. This is the MS response:
********
We first saw this problem a couple of weeks ago. Another customer reported
it and we noted that the index does get trashed when trying to add a record
to the read/write form.
The behavior occurs when these conditions are in place:
1. A table is used read only in a private data session of one form.
2. The same table is used read/write in a private data session of a second
form.
3. A new record is inserted from the second form.
4. The following sequence of commands are executed in the second form:
BEGIN TRANSACTION
TABLEUPDATE()
END TRANSACTION
**********
This can be very difficult to track down because it corrupts the index with
NO ERROR MESSAGE.
********* sample code to reproduce:
if !file("test.dbc")
create database test
create table testtable (cjunk c(10))
index on cjunk tag cjunk
use
endif
public goform1,goform2
goform1=create("frmreadonly")
goform1.show()
goform2=create("frmwrite")
goform2.show()
define class frmreadonly as form
datasession=2
procedure load
set exclusive off
use test!testtable order tag cjunk noupdate
endproc
enddefine
define class frmwrite as form
datasession=2
add object grid1 as grid
add object cmd1 as cmd
procedure load
set exclusive off
use test!testtable order tag cjunk
set multilocks on
cursorsetprop("buffering",5)
endproc
enddefine
define class cmd as commandbutton
caption="Insert"
procedure init
this.top=thisform.height-this.height
procedure click
begin transaction
append blank
replace cjunk with time()
if !tableupdate(.t.)
wait window "table update failed" nowait
endif
end transaction
thisform.refresh()
endproc
enddefine
>Hi there,
>
>I have got a form using optimistic, when I add a new record my indexes are not updated ! When I remove the buffering code and set the table to no buffering everything is ok.
>
>Where should I start ?
>
>Regards,
>
>Xavier
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only