Skip to content

Instantly share code, notes, and snippets.

@milleniumbug
Created February 9, 2018 13:17
Show Gist options
  • Save milleniumbug/3ba346ed5c803ecdb828843e3d143c78 to your computer and use it in GitHub Desktop.
Save milleniumbug/3ba346ed5c803ecdb828843e3d143c78 to your computer and use it in GitHub Desktop.
public IEnumerable<IDictionary<String, Object>> GetAllItems(SqlCommand command, string connectionString)
{
using (var connection = new SqlConnection(connectionString))
{
command.Connection = connection;
foreach(var item in command.ExecuteAndGetAllItems())
yield return item;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment