Bug #62063 Using MySQL connector for DOT.NET selecting row numbers fatal error
Submitted: 2 Aug 2011 21:54 Modified: 11 Aug 2011 13:41
Reporter: Josip Zovko Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.4.3.0 OS:Windows
Assigned to: Fernando Gonzalez.Sanchez CPU Architecture:Any

[2 Aug 2011 21:54] Josip Zovko
Description:
I'm trying via Visual Studio run any query that returns row number but all I get is fatal error. Any query  use via MySQL maestro which uses libmysql.dll producing good results on the same table. It seems to me there is a problem with the .net connector.

Example:

SET @rank=0;
SELECT @rank:=@rank+1 AS rank, itemID, COUNT(*) as ordercount
  FROM orders
  GROUP BY itemID
  ORDER BY ordercount DESC;

How to repeat:
By running any query that selects row number.

Example:

SET @rank=0;
SELECT @rank:=@rank+1 AS rank, itemID, COUNT(*) as ordercount
  FROM orders
  GROUP BY itemID
  ORDER BY ordercount DESC;
[4 Aug 2011 16:02] Fernando Gonzalez.Sanchez
Hi Josip,

Can you provide more info on how to reproduce this?
Like stack trace?
[9 Aug 2011 16:38] Fernando Gonzalez.Sanchez
Hi Josip, 

Thanks for the feedback, I was able to reproduce it.

However, this is not a bug, you can make the query work using the parameter AllowUserVariables in the connection string, for example:

new MySqlConnection("server=localhost;User Id=root;database=rowtest;AllowUserVariables=true")

(that flag works as a tip for the parameter binder).
[11 Aug 2011 13:41] Josip Zovko
This connection string flag works :))
Thanks a lot.