 <p><code>using (SqlConnection connection = new SqlConnection(@"Data Source=(local);Integrated Security=True;Initial Catalog=DB_Name;"))</code></p> <p><code>{</code></p> <p><code>connection.Open();</code></p> <p><code>using (SqlCommand command = connection.CreateCommand()) {</code></p> <p><code>command.CommandText =@"SELECT Name from Sysobjects where xtype = 'u'";</code> <code>using (SqlDataReader reader = command.ExecuteReader()) {</code></p> <p><code>while (reader.Read())</code> </p> <p><code>{</code> <code>// your code goes here...</code> <code>}</code> <code>}</code> }<code> </code>}`</p>