Need help in C# ( Visual Studio 2017 )
I want to get a data from my database from the last row or last inputted data. My code is here..
String query = "SELECT TOP(1) MessageNumber FROM ncslbpHighWay";
SqlCommand SDA = new SqlCommand(query, AR);
SqlDataReader data = SDA.ExecuteReader();
if (data.Read())
{
textBox2.Text = data.GetValue(0).ToString();
}
AR.Close();
I already got the data but from the specific column at the top only. I don't know how to get the bottom value.
Also i tried the DESC
but it doesn't work.
String query = "SELECT TOP(1) MessageNumber FROM ncslbpHighWay ORDER BY COLUMN DESC";
This is my first question here in Stackoverflow. I hope someone would help me on this.