Lista Estou enfrentando um problema que não sei mais o que faço para resolver.. Tenho um aplicativo que utiliza uma dll criada por mim... até ai tudo bem... dentro da dll tenho a função AcoesTabelaRateio ( Segue abaixo ) .. no aplicativo executo ela varias vezes seguidas... uma com a acao 3 .. e logo em seguida com a ação 1... Quando executo com a Acao 3 ele roda , mas quando executo com a acao 1 da erro "Access violation at address 00000000.Read of address 00000000".. ja coloquei o sharemem, na dll e no aplicativo... não tenho iédia do que pode ser... alguem tem uma idéia.. ??
vlw.. Wesley //Acoes na tanrla de rateios //------------------------------------------------------------------------------ procedure AcoesTabelaRateio ( Banco : TIbquery ; Acao : Integer ; CDRAT : Integer ; CDFIL , CDCEN , FLBXA : String ; DTVEN , DTDOC : TDateTime ; NRDOC , CDMOV , PLCON , VRRAT : String ) ; export ; stdcall ; begin with Banco do begin Close; Sql.Clear; //Incluir if Acao = 1 then begin Sql.Text := 'INSERT INTO FIN1100 ( CDRAT , CDFIL , CDCEN , ' + 'DTVEN , DTDOC , NRDOC , PLCON , VRRAT , DTLCT ) VALUES ( ' + ':CDRAT , :CDFIL , :CDCEN , :DTVEN , :DTDOC , :NRDOC , :PLCON, ' + ':VRRAT , CURRENT_DATE ) '; ParamByName('CDRAT').AsInteger := CDRAT ; ParamByName('CDFIL').AsInteger := StrToInt( Copy ( CDFIL , 1 , 4 ) ) ; if CDCEN <> '' then ParamByName('CDCEN').AsInteger := StrToInt( Copy ( CDCEN , 1 , 4 ) ) else ParamByName('CDCEN').Value := null ; ParamByName('DTVEN').AsDate := DTVEN ; ParamByName('DTDOC').AsDate := DTDOC ; ParamByName('NRDOC').AsInteger := StrToInt( Trim( NRDOC ) ); ParamByName('PLCON').AsInteger := StrToInt( Copy ( PLCON , 1 , 5 ) ); ParamByName('VRRAT').AsFloat := StrToFloat( Trim( RetiraPonto( VRRAT ) ) ); end; //Se é alterar ou Excluir if Acao > 1 then begin //Deleta Sql.Text := 'DELETE FROM FIN1100 WHERE CDRAT=:CDRAT'; ParamByName('CDRAT').AsInteger := CDRAT ; //Se for alterar inclui denovo if Acao = 2 then begin ExecSQL; Close; Sql.Clear; Sql.Text := 'INSERT INTO FIN1100 ( CDRAT , CDFIL , CDCEN , ' + 'DTVEN , DTDOC , NRDOC , PLCON , VRRAT , DTLCT ) VALUES ( ' + ':CDRAT , :CDFIL , :CDCEN , :DTVEN , :DTDOC , :NRDOC , :PLCON, ' + ':VRRAT , CURRENT_DATE ) '; ParamByName('CDRAT').AsInteger := CDRAT ; ParamByName('CDFIL').AsInteger := StrToInt( Copy ( CDFIL , 1 , 4 ) ) ; if CDCEN <> '' then ParamByName('CDCEN').AsInteger := StrToInt( Copy ( CDCEN , 1 , 4 ) ) else ParamByName('CDCEN').Value := null ; ParamByName('DTVEN').AsDate := DTVEN ; ParamByName('DTDOC').AsDate := DTDOC ; ParamByName('NRDOC').AsInteger := StrToInt( Trim( NRDOC ) ); ParamByName('PLCON').AsInteger := StrToInt( Copy ( PLCON , 1 , 5 ) ); ParamByName('VRRAT').AsFloat := StrToFloat( Trim( RetiraPonto( VRRAT ) ) ); end; end; ExecSQL; Close; end; end; //------------------------------------------------------------------------------ [As partes desta mensagem que não continham texto foram removidas]