1

i have this code:

using (MySql.Data.MySqlClient.MySqlConnection cn = new   
MySql.Data.MySqlClient.MySqlConnection(
            Properties.Settings.Default.CONNNConnectionString))
        {
            cn.Open();
            MySql.Data.MySqlClient.MySqlCommand cm = new 
            MySql.Data.MySqlClient.MySqlCommand();
            cm.CommandType = CommandType.Text;
            cm.Connection = cn;
cm.CommandText="CREATE  PROCEDURE `GetMovement`(RefArtt vARCHAR(20),idos INTEGER) "+
"BEGIN "+
"SET @Qt=0; "SELECT * ,@Qt:=@Qt+qteliv-qtesor as stock FROM tableInOut;"+
"End";
cm.ExecuteNonQuery();}

Exception : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''@Qt'=0; SELECT * ...

1 Answers1

0

Union should to write the same names or alias So, you can modify the alias to be the same in two select statement

nesreen
  • 201
  • 2
  • 14