protected void Page_Load(object sender, EventArgs e) { XMLAccess xmlAccess = new XMLAccess(); DataSet data = xmlAccess.GetBookNodes(); BooksGridView.DataSource = data.Tables[0]; BooksGridView.DataBind(); }
private void BindBookData() { string connectionString = ConfigurationManager.ConnectionStrings["Comp229-TeamAssign"].ConnectionString; SqlConnection conn = new SqlConnection(connectionString); SqlCommand comm = new SqlCommand("select * from MyBooks", conn); try { // Opening database connection conn.Open(); SqlDataReader reader = comm.ExecuteReader(); BooksGridView.DataSource = reader; BooksGridView.DataBind(); reader.Close(); } finally { //Closing database connection conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { _dataSet = CreateDataSet(); BooksGridView.DataSource = _dataSet.Tables["Books"]; BooksGridView.DataBind(); }