I want to show message if my sql request is done with no problems. In this moment i have code that show MessageBox for every successful done request, but if there is no username and is didn't done again it's showing the same messagebox.
try
{
using (SqlConnection con = new SqlConnection(constring))
{
con.Open();
using (SqlCommand command = new SqlCommand("DELETE FROM dbo.Admin WHERE UserName = '" + txtUserName.Text +"'", con))
{
command.ExecuteNonQuery();
MessageBox.Show("Successful operation!");
}
con.Close();
}
How can i fix that? I want to show successful operation only if there is result from sql request, not everytime when i am doing that command.