Hi,
SELECT machine_id,operator_id,member_id,card_id,name,paid_amount,due_amount,paid_date,phone_number ,@curRow := @curRow + 1 AS row_number FROM transaction JOIN (SELECT @curRow := 0) r where card_id=@card order by Row_number desc limit 3 ;
my query is giving correct results when i run in Mysql workbench. But in program it's giving error
Parameter '@curRow' must be defined.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: MySql.Data.MySqlClient.MySqlException: Parameter '@curRow' must be defined.
Source Error:
Line 218: MySqlCommand command3 = new MySqlCommand(query3, con);
Line 219: command3.Parameters.AddWithValue("@card", cardid);
Line 220: using (MySqlDataReader rdr3 = command3.ExecuteReader())
Line 221: {
Line 222: if (rdr3.Read())
Source File: E:\Online Billing System\Online Billing System\DataTransaction.aspx.cs Line: 220
Stack Trace:
[MySqlException (0x80004005): Parameter '@curRow' must be defined.]
MySql.Data.MySqlClient.Statement.SerializeParameter(MySqlParameterCollection parameters, MySqlPacket packet, String parmName, Int32 parameterIndex) +294
MySql.Data.MySqlClient.Statement.InternalBindParameters(String sql, MySqlParameterCollection parameters, MySqlPacket packet) +697
MySql.Data.MySqlClient.Statement.BindParameters() +128
MySql.Data.MySqlClient.Statement.Execute() +31
MySql.Data.MySqlClient.PreparableStatement.Execute() +59
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +1919
[MySqlException (0x80004005): Fatal error encountered during command execution.]
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +2531
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader() +32
Online_Billing_System.DataTransaction.Page_Load(Object sender, EventArgs e) in E:\Online Billing System\Online Billing System\DataTransaction.aspx.cs:220
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225