Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where ... like with parameter #143

Open
ChristophKe opened this issue Oct 28, 2022 · 1 comment
Open

where ... like with parameter #143

ChristophKe opened this issue Oct 28, 2022 · 1 comment

Comments

@ChristophKe
Copy link

how do I write a "like" with a parameter in a query?

... where col like "%?%"
with a given Parameter 'abc'

Leads to Exception (Length of parameters (1) does not match parameter count in query (0))

Christoph

@ArturPasetto
Copy link

ArturPasetto commented May 29, 2023

You can try this

MySqlConnection conn = await MySqlConnection.connect(...);
Results results = await conn.query("SELECT FROM table WHERE col LIKE CONCAT('%', ?, '%')", [variable]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants