Command.Prepare() makes command ignore parameters values

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
Max Kosenko
Posts: 1
Joined: Mon 14 Jul 2008 20:51

Command.Prepare() makes command ignore parameters values

Post by Max Kosenko » Mon 14 Jul 2008 21:02

Hello.

I'm evaluating MyDirect.NET and stuck with strange problem.
I was using document http://www.devart.com/mysqlnet/docs/Parameters.html

But no matter what I'm doing - in case I'm calling command.Prepare() - after that MySQL 5.1 Embedded doesn't see any parameter value (it's seeing NULL). But without Prepare() it's quite visible that performance is poor.

I have tried all possible things (and found that the problem is in Prepare), but nothing helps to stay with Prepare. Could you help me on that?

Sample:

Code: Select all

MySqlCommand intQuery = con.CreateCommand();

intQuery.CommandText = "SELECT T1.i,T1.s FROM TestIndex as T1 WHERE T1.i = :param";

intQuery.Parameters.Add(new MySqlParameter(":param", MySqlType.BigInt)); //It doesn't matter if param without ":" or with "@" or unnamed at all.

//intQuery.Prepare(); // Uncomment this - and nothing works on same DB
        
intQuery.Parameters[0].Value = key;
reader = intQuery.ExecuteReader();
bool found = reader.Read();

Now, "found" always == false (no matter what's in Value) if I'm calling Prepare(). And always == true without Prepare (and correct value).

That's definetly a problem somewhere in provider. But I don't have sources and don't want to decompile DLL.


Will be very glad for any real help.
Spent a lot of time with it already.

Best Regards. Max

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 24 Jul 2008 16:28

Hello, Max.

We are investigating the problem, but the situation appears to be quite difficult. No timeframe is available.
We think the problem is the issue of the MySQL Embedded server itself, though.

Regards, Andrey.

Post Reply