|Hi i have created one web application and in that i need to read the data from Mysql database and bind to gridview.
I have written Mysql query as follows
SELECT @row_number:=@row_number+1 AS row_number,Name FROM tablename, (SELECT @row_number:=0) AS r
After running in Mysql in database it will and work show the result.
But if take same query and execute through C# code below error is coming.
An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll but was not handled in user code
Additional information: Fatal error encountered during command execution.
and i will get Break or continue pop up. If i give continue it will show Parameter '@row_number' must be defined.
even i defined like int @row_number = 0; but same error.
I need to achieve serial number as shown below
ex in database
how to achieve this. If anybody knows please reply me.
Thanks in advance.