Error: 102 run query via Msexecauto

Asked

Viewed 315 times

1

I have little experience in advpl. I was studying the subject and I have a little problem. I get the erro 102 how much I try to include a registration in the direct client table on Protheus.

I tried to include a register via SQL SERVER and I was successful. I can verify that the record was included in the table, but when I open the totvs I can’t locate any records. Why is this happening? Thank you in advance!

Follow the error:

> Exceção ocorrida: : Error : 102 (37000) (RC=-1) - [Microsoft][ODBC SQL
> Server Driver][SQL Server]Sintaxe incorreta próxima a ''. ( From
> tMSSQLConnection::GetQueryFile ) Thread ID [8376] User [wdrik]    IO
> [13168]   Tables [9]  MaxTables [9]   Comment []  Status []   SP [ ]  Traced
> [No]  InTran [Yes]    DBEnv [MSSQL/P11]   DBThread [(SPID 53,54)] Started
> [02/10/2016 21:07:38] LastIO []   IP [127.0.0.1:1234] RCV [118535]    SND
> [501865]  TCBuild [20141119]   SELECT DISTINCT Z90.Z90_DESCRI,Z92.* FROM
> Z90990 Z90 , Z92990 Z92 WHERE  Z90.Z90_FILIAL = '  ' AND
> Z90.D_E_L_E_T_= ' ' AND Z92.Z92_FILIAL = '  ' AND Z92.D_E_L_E_T_= ' '
> AND Z92.Z92_EST IN ('SP' ) ''

3 answers

0

Hello Friend the error is in the executed syntax:

  SELECT DISTINCT Z90.Z90_DESCRI,Z92.* FROM Z90990 Z90 , Z92990 Z92 
WHERE   Z90.Z90_FILIAL = '  '   AND
        Z90.D_E_L_E_T_= ' '     AND 
        Z92.Z92_FILIAL = '  '   AND 
        Z92.D_E_L_E_T_= ' '     AND 
        Z92.Z92_EST IN ('SP' ) ''

Notice that at the end of the query there are quotation marks ? , see the variable that treats the query and adjust these characters remaining.

A detail, whenever I call direct query I do as follows:

cQuery := " UPDATE " + RetSqlName("ZBR")
cQuery += " SET ZBR_STATUS = '2' "
cQuery += " WHERE ZBR_DATA = '"+DTOS(_dDataPr)+"' "
cQuery += " AND ZBR_INTER  = '11' "
cQuery += " AND D_E_L_E_T_ = '' "
nRet := TcSqlExec( cQuery )
If nRet == 0
    // Deu certo
else
    // Faz algo se der errado
Endif

0

Sometimes I have problems with changes directly in the bank, in some cases restart the dbAccess/Topconnect solves the problem, but beware of changes on the outside, it is not recommended practice. If not, delete the record from the database (don’t forget to update it RECDEL, if there is) and do the inclusion or the automatic routine, as the friend commented, or go on APSDU and manually include.

0


Protheus creates several controls such as R_E_C_N_O_, in the table, when entering data via direct SQL you will have problems. In fact, you should use the MATA010 Automatic Routine to enter data into the SA1.

Skin error you posted, it seems to be error of some complement table.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.