Good Mornig:
I'll appreciate so much if someone can help me where to find documentation and examples about the use od ActiveX Data Objects in Navision. Now i am using version 2.7.
With the next code I can make modifications to record in DBASE IV, but, if the record already exists the application stop execution.
SQL_Insert:='INSERT INTO '+rec_Config_Cont."Tabla Artículos";
SQL_Insert+='(AL_CODEART,AL_DESCRIP,TARIFA_1,COSTEUNI,AL_CODPRO,AL_MINIMA,TARIFA_2,TIPO_IVA,AL_PEDIDO,AL_FAMI_AR,';
SQL_Insert+='SUBFAMILIA,AL_COD_FAB) ';
SQL_Insert+='VALUES('''+rec_producto."No."+''','''+CONVERTSTR(rec_producto.Description,'''',' ')+''',';
SQL_Insert+=pvp+',';
SQL_Insert+=CONVERTSTR(FORMAT(rec_producto."Unit Cost"),',','.');
SQL_Insert+=','''+rec_producto."Vendor No."+''',';
SQL_Insert+=FORMAT(rec_producto."Reorder Point")+',';
SQL_Insert+=pvr+',';
SQL_Insert+=''+rec_Grupo_Reg_IVA_Prod.IVA_DbaseIV+','+FORMAT(rec_producto."Cant.Ped.Minimo Tienda")+',';
SQL_Insert+='''' + rec_producto."Item Category code"+''','''+rec_producto."Product Group Code"+''',';
SQL_Insert+='''' + rec_producto."No." + ''')';
//Ejecución de la sentancia SQL
DBFRecord.Open(SQL_Insert,DBFConnect,2,3);
This code works but if the record exists it gives an error and stop the process, then, i need to capture the error and control it.
Many thanks in advance
Italo Cafferata
0
Comments
gblAdoCommand.CommandType := 1;
gblAdoCommand.ActiveConnection(gblCadenaConexion);
cadenaSql := STRSUBSTNO('INSERT INTO %1 (%2) VALUES (%3)', tabla, campos, valores);
gblAdoCommand.CommandText := cadenaSql;
gblAdoCommand.Execute(numRegistros);
EXIT(numRegistros);
If numRegistros=0 Then some error occurs.
Another way is writing a wrapper that allows you to properly control any errors.
-- Alejandro --