FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
Delete all records in file
Delete all records in file
Débuté par John Marrone, 19 mai 2005 18:16 - 4 réponses
Connectez-vous…
John Marrone
#1
Posté le 19 mai 2005 - 18:16
Hi All
I just want to delete all the records in a file. Here is my code.
IF HNbRec(PPLines) > 0 AND NOT HOut(PPLines) THEN
FOR i = 1 TO HNbRec(PPLines)
HDelete(PPLines, hCurrentRecNum )
END
END
It fails the if statment. HOut is true so it must be something to do with the HNbRec part. Anyone know a quicker way to delete all records in a HF.
Regards
John
Signaler
0
0
Christian Potvin
#2
Posté le 20 mai 2005 - 22:20
HCreate(PPLines) ? See help...
Christian Potvin
Beaulieu Canada
Hi All
I just want to delete all the records in a file. Here is my code.
IF HNbRec(PPLines) > 0 AND NOT HOut(PPLines) THEN
FOR i = 1 TO HNbRec(PPLines)
HDelete(PPLines, hCurrentRecNum )
END
END
It fails the if statment. HOut is true so it must be something to do with the HNbRec part. Anyone know a quicker way to delete all records in a HF.
Regards
John
Signaler
0
0
Micher Herrscher
#3
Posté le 21 mai 2005 - 19:27
Dans un message John Marrone disait :
Hi All
I just want to delete all the records in a file. Here is my code.
IF HNbRec(PPLines) > 0 AND NOT HOut(PPLines) THEN
FOR i = 1 TO HNbRec(PPLines)
HDelete(PPLines, hCurrentRecNum )
END
END
It fails the if statment. HOut is true so it must be something to do
with the HNbRec part. Anyone know a quicker way to delete all records
in a HF. Regards
May be it is normal as you do not position the file to the next record to be
deleted,
may be better to do
1) hferme( PPlines) ; Hcreate (pplines) // note that this will reset the
Automatic id if any ;
2) or to keep the autoid continuing its own way:
either
2.1
pour pplines sur idxxx
hdelete(pplines)
fin
or
2.2 or a " requete "
delete * from pplines
Hope this help you
(excuse the mix of french + english...)
--
Michel HERRSCHER CONSULTANT
Président WINDASSO - Association des utilisateurs WxxDEV(c)
Tel : +33450870912 Fax:+33450871741
http://www.windasso.org
Signaler
0
0
Norman
#4
Posté le 01 juin 2005 - 14:08
Theoretically HCreation does it. BUT in a mylti-user environment it doesn't work the way you think.
I do the delete on active records. I find this works well -
My file here is called Sage8 and the index I am using is S8A.
HReadFirst(Sage8,S8A)
LOOP
IF HOut(Sage8) THEN BREAK
IF HState(Sage8)= hStateActive THEN
HDelete(Sage8,hCurrentRecNum)
END
HReadNext(Sage8,S8A)
END
(Some of your records you are reading are probably deleted and the Hout is bombing it out). I also tend to write some code in to check the file is not in use, after all it should really be closed and not in use.
Then do this -
Myvar is boolean
Mode is int
Directory is string= datadirectory
WindowHandle is int = Handle()
Mode = hNdxDelete
LogicalFileName is string ="SAGE8"
PhysicalFileName is string="SAGE8"
Myvar= HIndex(LogicalFileName, PhysicalFileName,Directory, Mode, WindowHandle)
IF Myvar = False THEN
Error("Hyper File error: " + HErrorInfo())
END
This gets rid of the space and checks the file at the same time.
Norman
ZiPZAP Computers Limited, Lincoln UK.
Signaler
0
0
Micher Herrscher
#5
Posté le 01 juin 2005 - 19:23
may be faster :
create a request containing something like :
delete * from Sage8
--
Michel HERRSCHER CONSULTANT
Président WINDASSO - Association des utilisateurs WxxDEV(c)
Tel : +33450870912 Fax:+33450871741
http://www.windasso.org
Dans un message Norman disait :
Theoretically HCreation does it. BUT in a mylti-user environment it
doesn't work the way you think.
I do the delete on active records. I find this works well -
My file here is called Sage8 and the index I am using is S8A.
HReadFirst(Sage8,S8A)
LOOP
IF HOut(Sage8) THEN BREAK
IF HState(Sage8)= hStateActive THEN
HDelete(Sage8,hCurrentRecNum)
END
HReadNext(Sage8,S8A)
END
(Some of your records you are reading are probably deleted and the
Hout is bombing it out). I also tend to write some code in to check
the file is not in use, after all it should really be closed and not
in use.
Then do this -
Myvar is boolean
Mode is int
Directory is string= datadirectory
WindowHandle is int = Handle()
Mode = hNdxDelete
LogicalFileName is string ="SAGE8"
PhysicalFileName is string="SAGE8"
Myvar= HIndex(LogicalFileName, PhysicalFileName,Directory, Mode,
WindowHandle) IF Myvar = False THEN
Error("Hyper File error: " + HErrorInfo())
END
This gets rid of the space and checks the file at the same time.
Norman
ZiPZAP Computers Limited, Lincoln UK.
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte