error al eliminar con tdolphin y mysql

error al eliminar con tdolphin y mysql

Postby kpidata » Fri Jan 12, 2018 6:07 pm

Estimados se me presenta el siguiente error..

Tengo una consulta, de una tabla, que deseo eliminar un resgistro... tengo otras tablas y uso la misma rutina y borra y procesa bien, pero esta me da problemas.. la tenia con JOIN, y se caia todo, se los saque y cuando proceso, me sale esto..


Time from start: 0 hours 0 mins 59 secs
Error occurred at: 12/01/2018, 15:00:49
Error description: Error BASE/1005 Class: 'ARRAY' has no property: BGOTOP
Args:
[ 1] = A { ... }
[ 2] = B {|| ... }

Stack Calls
===========
Called from: => _BGOTOP( 0 )
Called from: D:\KPIWEB\PRG\setbrw.prg => SETDOLPHIN( 22 )
Called from: D:\KPIWEB\PRG\extintores.prg => ELIMINARECEPEXTINTOR( 4855 )
Called from: D:\KPIWEB\PRG\extintores.prg => (b)ELIMINA_RECEPEXTINTOR( 4840 )

y la funcion es

// nNro_Rec = numero de orden a eliminar
// cExt_Rec = tabla que contiene los datos
// oBrw2 = es el objeto en xBrowse que contiene la tabla
// y la abro asi..
// cExt_Rec1:=xServer:Query("SELECT * FROM ext_rec1 WHERE nro_rec >='"+Alltrim(Str(cFolio1))+"' and nro_rec<='"+Alltrim(Str(cFolio2))+"' ORDER BY nro_rec")


FUNCTION EliminaRecepExtintor(cAClave,oBrw2,cEmpresa,nNro_Rec,cExt_Rec1)
Local Mensaje, cSql

Mensaje := Space(40)

If Alltrim(cAclave)=Alltrim( cEmpresa [15])

cExt_Rec1:delete()
SetDolphin( oBrw2, cExt_Rec1,.f. )
oBrw2:SetFocus()
oBrw2:Refresh()

cSql:="DELETE FROM Ext_Otr1 WHERE nro_rec='"+Alltrim(Str(nNro_Rec))+"'ORDER BY nro_rec"
xServer:Execute( cSql )

Else
TipoMensaje("Usuario no habilitado")
Endif
RETURN( NIL )
kpidata
 
Posts: 42
Joined: Tue Jul 26, 2016 9:52 pm

Re: error al eliminar con tdolphin y mysql

Postby joseluisysturiz » Sat Jan 13, 2018 4:21 pm

Buen dia, esta tabla Ext_Otr1 la tienes relacionada.? a mi me da error eliminando cuando esta relacionada y por eso uso DELETE LOW_PRIORITY o si no debes usar la misma sintaxis del SELECT pero con DELETE...y no olvides dejar un espacio en blanco entre cada una de las clausulas en la setencia SQL cuando usas las variables, revisa antes de la clausula ORDER BY, ejemplo: "DELETE FROM Ext_Otr1 WHERE nro_rec='"+Alltrim(Str(nNro_Rec))+"' ORDER BY nro_rec"...saludos, gracias... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 1832
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: error al eliminar con tdolphin y mysql

Postby Kleyber » Sun Jan 14, 2018 2:49 am

Hola,

No existe DELETE con ORDER BY...
Kleyber Derick

FWH / xHb / xDevStudio / SQLLIB
User avatar
Kleyber
 
Posts: 580
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Re: error al eliminar con tdolphin y mysql

Postby joseluisysturiz » Sun Jan 14, 2018 6:16 pm

Kleyber wrote:Hola,

No existe DELETE con ORDER BY...

Kleyber, refuto tu afirmacion...saludos... :shock:


https://dev.mysql.com/doc/refman/5.7/en/delete.html

Single-Table Syntax

DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
[PARTITION (partition_name [, partition_name] ...)]
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]

Order of Deletion

If the DELETE statement includes an ORDER BY clause, rows are deleted in the order specified by the clause. This is useful primarily in conjunction with LIMIT. For example, the following statement finds rows matching the WHERE clause, sorts them by timestamp_column, and deletes the first (oldest) one:

DELETE FROM somelog WHERE user = 'jcole'
ORDER BY timestamp_column LIMIT 1;

ORDER BY also helps to delete rows in an order required to avoid referential integrity violations
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 1832
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: error al eliminar con tdolphin y mysql

Postby cmsoft » Mon Jan 15, 2018 11:05 am

Code: Select all  Expand view
cSql:="DELETE FROM Ext_Otr1 WHERE nro_rec='"+Alltrim(Str(nNro_Rec))+"' ORDER BY nro_rec"

Si tienes el programa tal cual lo pusiste en el foro, te falta un espacio en la sentencia cuando concatenas..
User avatar
cmsoft
 
Posts: 465
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 5 guests