1
I’m starting to develop reports in Visual Studio 2013, using C# with Mysql. At the moment, I was able to make a report without parameters, but when I enter parameters in the query, it returns an error.
The consultation I put on dataset
is the following
SELECT celular, codigo, cpf, dt_nascimento, email, nome, observacao, rg, sexo, telefone
FROM tb_clientes
WHERE nome like '%' + @p_nome + '%';
Without the clause WHERE
, the report performs normally.
I saw an example in internet using this form of parameter passing, however, the database was SQL Server.
Post the C# code so we will know better how the parameters are being passed to Mysql
– StillBuggin
Hello, there is still no code to pass the parameter in the report, only this query directly in the reportview with the name @p_name already giving error. The error of exactly p_name, it seems that the query made in mysql does not accept this parameter.
– Sergio Silva
You created the @p_name variable?
– Marco Souza
Then you’ll have to use
SET @p_nome = 'alguma coisa'
to be able to test the code directly in MYSQL without passing the parameters through C#. See about parameterized query.– StillBuggin
yes the @p_name parameter was created in the reportviewer menu, only when I inform the parameter in the query, it seems that mysql does not understand, I tried to do the SET @p_namethat Eduardo helped, it actually works directly in Mysql, but when I inform in the dataset it of the error in the query, it seems that it does not recognize the parameter, or does not recognize it as the beginning of a parameter.
– Sergio Silva
Put the example link to SQL Server?!
– StillBuggin
I am without sql server now on the computer to send, but only putting the parameter @parameter_name, would already work within the like in the database. I am sending the link of the query I put in sql server with the parameter, but in mysql it does not work, I wonder if you have any example for mysql.Follow the link of the report query in reportviewer using sql server. https://dl.dropboxusercontent.com/u/7125864/Imagem.jpg
– Sergio Silva