コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        XMLAccess xmlAccess = new XMLAccess();
        DataSet   data      = xmlAccess.GetBookNodes();

        BooksGridView.DataSource = data.Tables[0];
        BooksGridView.DataBind();
    }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _dataSet = CreateDataSet();
     BooksGridView.DataSource = _dataSet.Tables["Books"];
     BooksGridView.DataBind();
 }