string connString
= ConfigurationManager.ConnectionStrings["NorthwindConn"].ConnectionString;
SqlConnection conn = new SqlConnection(connString);
string
query = "SELECT * FROM Customers";
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
DataTable
dt = new DataTable();
dt.Load(dr);
conn.Close();
No comments:
Post a Comment