erase a datarow entirely with a single command ?

erase a datarow entirely with a single command ?

Postby mauri.menabue » 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: Select all  Expand view  RUN


   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
 
User avatar
mauri.menabue
 
Posts: 155
Joined: Thu Apr 17, 2008 2:38 pm

Re: erase a datarow entirely with a single command ?

Postby nageswaragunupudi » Fri Jun 02, 2023 4:06 am

Either
Code: Select all  Expand view  RUN
::oRsDel:gotop()
  do while .not. ::oRsDel:eof()
      ::oRsDel:delete()
//      ::oRsDel:skip() // remove this line
 enddo
 


OR this is better
Code: Select all  Expand view  RUN
oCn:Execute( "DELETE FROM <table> WHERE <cond>" )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: erase a datarow entirely with a single command ?

Postby mauri.menabue » Fri Jun 02, 2023 11:33 am

Thank you Master !
Maurizio Menabue
User avatar
mauri.menabue
 
Posts: 155
Joined: Thu Apr 17, 2008 2:38 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 75 guests