title: How to show value printed by sql query in message box
body: <p>I want to print a value that is returned by SQL Server.</p>
  
  <pre><code>If NOT Exists(SELECT * FROM ItemList WHERE ItemName='txtItemNama') 
     BEGIN   
      INSERT INTO ItemList (ItemName) VALUES('txtItemNamea')  
     END 
  ELSE  
     BEGIN 
      Print 'Duplicate' 
     END
  </code></pre>
  
  <p>This query will either return me either number of rows affected or <strong>Duplicate</strong></p>
  
  <p>I want to use this Duplicate in C# in <code>MessageBox.Show()</code></p>
  
  <pre><code>string query1 = "If NOT Exists(SELECT * FROM ItemList WHERE ItemName='txtItemName') BEGIN  INSERT INTO ItemList (ItemName) VALUES('txtItemName')  END ELSE  BEGIN Print 'Duplicate' END";
              SqlCommand cmd = new SqlCommand(query1, conn);
              SqlDataReader dr;
              conn.Open();
              dr=cmd.ExecuteReader();
              conn.Close();
  MessageBox.Show(dr);
  </code></pre>
  
  <p>I don't know how to use <code>dr</code> to do this. Please help me out to print Duplicate here</p>
  
  <p><strong>MessageBox.Show(dr);</strong></p>
  
  <p>What do I need to do here?</p>