PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → [WD55] INDEX BROKEN and LOCKFILE!!!!!
[WD55] INDEX BROKEN and LOCKFILE!!!!!
Started by Jaime Rodriguez, Feb., 13 2004 2:56 PM - No answer
Posted on February, 13 2004 - 2:56 PM
hi group,
I am a ecuadorian programer ans sorry for my english I'm not write very well

I have a WORKGROUP with 10 machines with WINDOWS 2000 Professional and a
aplicattion running in WD55 when

at the first time I have a problem when a severals users try to HADD records
at the same table .fic but de INDEX BROKEN when two or more users try to ADD
a new record in the table and every time they need to REINDEX de files

I see in a document at the HELP file that the WINDEV have a automatical
control for MODIFY same records two or more users but don't have a automatic
control for ADD record

At the HELP file says that I need to do this manually :-( using LOCKS
file with HLockFile of course that this give me a solution and index broken
no more, but the files at the some times mantein de state LOCKED and the
others user can't work the code its the folowing :

if tableseek("descripcion",txtDescripViv,false) < 0 and txtdescripviv <> ""
then
hreadlast("vivienda","cod_viv")
viv = "VV" +
repete("0",6-length(numtostring(val(middle(vivienda.cod_viv,3,6))+1)))+
numtostring(val(middle(vivienda.cod_viv,3,6))+1)
vivienda.cod_viv = viv
vivienda.descripcion = txtDescripViv
vivienda.cod_tipoviv =
extractstring(lstTipoviv[listselect("lstTipoviv")],2)
vivienda.cod_calle1 = txtcod_calle1
vivienda.cod_calle2 = txtcod_calle2
vivienda.numdirec = txtNumdirec
hlockfile("vivienda")
loop
hadd("vivienda")
if not hislocked() then break
end
hunlockfile("vivienda")
clientes.cod_viv = viv
//clientes.cod_tipoviv = tviv
else
hreadseek("vivienda","cod_viv",complete(cod_viv,10))
if h.found then
viv = vivienda.cod_viv
if nospace(vivienda.cod_calle1) <> nospace(txtcod_calle1) or
nospace(vivienda.cod_calle2) <> nospace(txtcod_calle2) then
vivienda.cod_calle1 = txtcod_calle1
vivienda.cod_calle2 = txtcod_calle2
vivienda.numdirec = txtNumdirec
hlockfile("vivienda")
loop
hmodify("vivienda")
if not hislocked() then break
end
hunlockfile("vivienda")
END
end
clientes.cod_viv = viv
//clientes.cod_tipoviv = tviv
end

this process with de LOOP are in the HELP manual but some time the first
machine that locked de file its mantein in the LOOP for a 20 or 25 seconds
and the other users can't works

How a can give a solution

Thanks a lot

JAROD