Error: 102 execute query via MsExecAuto

1

I have little experience with advpl . I was studying the subject and I have a problem. I get erro 102 when I try to include a record in the direct clients table in Protheus .

I tried to include a registration via SQL SERVER and I was successful. I can check that the record was included in the table, but when I open totvs I can not find any records. What is the reason for this? Thank you in advance!

The following is 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' ) ''
    
asked by anonymous 03.10.2016 / 02:28

3 answers

0

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

Skin error that you posted, seems to be an error in some add-in table.

    
09.11.2016 / 01:40
0

Sometimes I have problems with direct changes to the database, in some cases restarting dbAccess / TopConnect solves the problem, but beware of changes from the outside, is an unsuitable practice >. If it does not resolve, delete the record by the bank (do not forget to update the RECDEL , if it exists) and do the inclusion or automatic routine, as your friend commented, or go to APSDU and include manually.

    
24.02.2017 / 20:27
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 no quotation marks?, see the variable that treats the query and set these characters left over.

A detail, whenever I make direct query call I do the following:

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
    
25.05.2017 / 21:04