Great for populating just about anything you can databind.
using System.Configuration; using System.Data.SqlClient; using System.Data; private DataSet GetData(string query) { SqlCommand cmd = new SqlCommand(query); using (SqlConnection con = new SqlConnection(connString)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataSet ds = new DataSet()) { sda.Fill(ds); return ds; } } } }
Last Updated on October 26, 2015