FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour erase a datarow entirely with a single command ?
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM

erase a datarow entirely with a single command ?

Posted: Thu Jun 01, 2023 11:26 AM
hi all
is it possible to completely delete a datarow with a single command if so which one?
Code (fw): Select all Collapse
   LOCAL oRsDel AS OBJECT
   LOCAL cSql    AS CHARCTER 
   
   cSql := ""
   cSql += "SELECT *" + " " 
   cSql += "FROM " + ::cTabellaTestate + " "   
   cSql += "WHERE " + ::cCampoFiltro + " >= ? AND "  
   cSql += ::cCampoFiltro + " <= ?"  
   ::oRsDel := ::oCn:RowSet( cSql, { ::uValDa, ::uValA } )
 
  ::oRsDel:deleteall()

  *- or only method is 

  ::oRsDel:gotop()
  do while .not. ::oRsDel:eof()
      ::oRsDel:delete()
      ::oRsDel:skip()
 enddo
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: erase a datarow entirely with a single command ?

Posted: Fri Jun 02, 2023 04:06 AM
Either
Code (fw): Select all Collapse
 ::oRsDel:gotop()
  do while .not. ::oRsDel:eof()
      ::oRsDel:delete()
//      ::oRsDel:skip() // remove this line
 enddo
OR this is better
Code (fw): Select all Collapse
oCn:Execute( "DELETE FROM <table> WHERE <cond>" )
Regards



G. N. Rao.

Hyderabad, India
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM

Re: erase a datarow entirely with a single command ?

Posted: Fri Jun 02, 2023 11:33 AM

Thank you Master !

Maurizio Menabue

Continue the discussion