Universal dotconnect mysql parameter problem

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
mobra
Posts: 2
Joined: Mon 25 Apr 2016 15:31

Universal dotconnect mysql parameter problem

Post by mobra » Mon 25 Apr 2016 15:43

Hi,
Since the updated universal dotconnect release for Visual Studio 2015 the parameters aren't working for mysql.
Running the same query, but replacing the parameter with quoted text i get the correct results.
I made a sample: http://mobra.erpos.ro/Products/UniDirectTest.zip
Any idea?

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Universal dotconnect mysql parameter problem

Post by Pinturiccio » Wed 27 Apr 2016 15:01

dotConnect Universal has two types of the named parameters. The difference between them lies in prefixes ':' and '@'. Name of the UniParameter object in the command collection should contain the '@' prefix, if parameter in CommandText is used with the '@' prefix. For more information, please refer to https://www.devart.com/dotconnect/unive ... eters.html

To fix the issue, add the '@' character before the parameter name. Your code should look like the following:

Code: Select all

string commandText = string.Format(txtCommand.Text, "@ModuleId");
UniCommand cmd = new UniCommand(commandText, this.connection);
UniParameter p = new UniParameter("@ModuleId", UniDbType.VarChar);

mobra
Posts: 2
Joined: Mon 25 Apr 2016 15:31

Re: Universal dotconnect mysql parameter problem

Post by mobra » Fri 29 Apr 2016 06:35

Thank you, it seems that it works, at least in this example.
Pretty annoying update, i have a few hundred queies (or better, thousands) in a single app, and is working well with version 3.5. Now i must update to 3.6 and all of them are broken :(

Thank you, again.
m.

Post Reply