I have a method that moves a row from one table to another. That itself works fine. What I am trying to do now is to select the highest value of a cell inside the table Callbacks. This is what I have tried:
public static void MoveLead(RadGridView Gridview, RadDropDownList SegmentDropdown, string UniqueID)
{
try
{
string Table = SegmentDropdown.Text;
using (MySqlConnection cn = new MySqlConnection(Varribles.ConString))
{
string query = "BEGIN; select max(UniqueID) from Callbacks; INSERT INTO Callbacks select * from " + Table + " where UniqueID = " + UniqueID + "; DELETE FROM " + Table + " where UniqueID = " + UniqueID + "; COMMIT;";
cn.Open();
using (MySqlCommand cmd = new MySqlCommand(query, cn))
{
cmd.CommandText = query;
cmd.ExecuteNonQuery();
Console.WriteLine("query" + Convert.ToInt32(cmd.ExecuteScalar()));
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
Thanks in advance