Page 1 of 1

error al eliminar con tdolphin y mysql

PostPosted: Fri Jan 12, 2018 6:07 pm
by kpidata
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 )

Re: error al eliminar con tdolphin y mysql

PostPosted: Sat Jan 13, 2018 4:21 pm
by joseluisysturiz
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:

Re: error al eliminar con tdolphin y mysql

PostPosted: Sun Jan 14, 2018 2:49 am
by Kleyber
Hola,

No existe DELETE con ORDER BY...

Re: error al eliminar con tdolphin y mysql

PostPosted: Sun Jan 14, 2018 6:16 pm
by joseluisysturiz
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

Re: error al eliminar con tdolphin y mysql

PostPosted: Mon Jan 15, 2018 11:05 am
by cmsoft
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..