Problem with Parameter

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
demensys
Posts: 2
Joined: Mon 17 Jul 2006 13:28

Problem with Parameter

Post by demensys » Mon 31 Jul 2006 10:08

I want to use a Parameter in a SQL Statment like:

Code: Select all

SELECT * FROM contracts where `status` in (:Status) order by id desc limit 50;
Status is declaratet as a VarChar.

The Parameter Status is a list off Strings.
This is an Exampel off the SQL Statment without Parameters:

Code: Select all

SELECT * FROM contracts where `status` in ('Eingestellt','Versendet','Kein Interesse') order by id desc limit 50;
The Problem is, that the Execute Statement is:

Code: Select all

SELECT * FROM contracts where `status` in ("'Eingestellt','Versendet','Kein Interesse'") order by id desc limit 50;
Which Parameter Type i must use for this?

Thanks for your Help!

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 31 Jul 2006 14:55

You cannot use parameters this way. MySQLDirect .NET doesn't support string formatting.

demensys
Posts: 2
Joined: Mon 17 Jul 2006 13:28

Post by demensys » Mon 31 Jul 2006 19:24

have you an ather way to fix this problem?

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 01 Aug 2006 06:29

You may perform string formatting yourself. This is the best way to solve the problem.

Post Reply