Page 1 of 1

Internal error when loading a dropdown with SQL Server

Posted: Fri Jul 03, 2020 10:23 am
by AthosFer
Hi.
I'm trying to load a dropdown with data from an external DB (SQL Server 11), but this error shows up and won't let me continue.
issue.png
issue.png (5.61 KiB) Viewed 832 times
I'm already using data from this DB in another form with another query, however, in this specific case, I have the error.
Can someone help me?
Thanks.

That's the query (in HeidiSQL it works just fine):
Code: Select all
SELECT Forneced.fornecedor, PessoaFJ.RazaoSocial FROM dbo.forneced
JOIN PessoaFJ ON PessoaFJ.empresa = Forneced.emppessoa
AND PessoaFJ.filial = Forneced.FilPessoa
AND fornecedor = pessoa
WHERE PessoaFJ.indativo = 'S'
AND PessoaFJ.IndFisJur = 'J'
AND forneced.empresa = @%EMPRESA
AND Forneced.TipoTributacao = 31
ORDER BY fornecedor

Re: Internal error when loading a dropdown with SQL Server

Posted: Sat Jul 04, 2020 7:01 am
by programerboy
Hi,
Please use query like this:
Code: Select all
SELECT Forneced.fornecedor, PessoaFJ.RazaoSocial FROM dbo.forneced
JOIN PessoaFJ ON PessoaFJ.empresa = Forneced.emppessoa
AND PessoaFJ.filial = Forneced.FilPessoa
AND fornecedor = pessoa
WHERE PessoaFJ.indativo = 'S'
AND PessoaFJ.IndFisJur = 'J'
AND forneced.empresa = '@#EMPRESA'
AND Forneced.TipoTributacao = 31
ORDER BY fornecedor
Please check the following link:
pmlearning.info

Re: Internal error when loading a dropdown with SQL Server

Posted: Mon Jul 06, 2020 7:17 am
by AthosFer
programerboy wrote:Hi,
Please use query like this:
Code: Select all
SELECT Forneced.fornecedor, PessoaFJ.RazaoSocial FROM dbo.forneced
JOIN PessoaFJ ON PessoaFJ.empresa = Forneced.emppessoa
AND PessoaFJ.filial = Forneced.FilPessoa
AND fornecedor = pessoa
WHERE PessoaFJ.indativo = 'S'
AND PessoaFJ.IndFisJur = 'J'
AND forneced.empresa = '@#EMPRESA'
AND Forneced.TipoTributacao = 31
ORDER BY fornecedor
Please check the following link:
pmlearning.info
Hi.
Thanks for your reply.
I tried your suggestion but it still doesn't work. Any other options?

Re: Internal error when loading a dropdown with SQL Server

Posted: Mon Jul 06, 2020 3:03 pm
by programerboy
Do you have problem just with this query or any other query?
You can create a view from your query and use a simple query in your dropdown and test it

Please check the following link:
pmlearning.info