Blog Of Sem: VISUAL C# SQL AYNI KOD VARMI KONTROL

VISUAL C# SQL AYNI KOD VARMI KONTROL

      private void button3_Click(object sender, EventArgs e)
        {
            SqlConnection sqlConnection = new SqlConnection("Server = " + logoserver + "; Database = " + logodb + "; User Id = " + logouser + "; Password = " + logopass);


            using (SqlCommand sqlCommand = new SqlCommand("SELECT COUNT(*) from ZV_LOGO_HASTA where KODU = 112", sqlConnection))
            {
                sqlConnection.Open();
                int userCount = (int)sqlCommand.ExecuteScalar();
                if (userCount > 0)
                {
                    MessageBox.Show("BU KOD VAR");
                }
                else MessageBox.Show("BU KOD YOK");
            }
            sqlConnection.Close();
        }