error al eliminar con tdolphin y mysql

Post Reply
kpidata
Posts: 73
Joined: Tue Jul 26, 2016 9:52 pm

error al eliminar con tdolphin y mysql

Post 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 )
User avatar
joseluisysturiz
Posts: 2024
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: error al eliminar con tdolphin y mysql

Post 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:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
Kleyber
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Re: error al eliminar con tdolphin y mysql

Post by Kleyber »

Hola,

No existe DELETE con ORDER BY...
Kleyber Derick

FWH / xHb / xDevStudio / SQLLIB
User avatar
joseluisysturiz
Posts: 2024
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: error al eliminar con tdolphin y mysql

Post 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
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
cmsoft
Posts: 653
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: error al eliminar con tdolphin y mysql

Post by cmsoft »

Code: Select all

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..
Post Reply