Exemplo n.º 1
0
    private dsAddress BindGridView()
    {
        //TempPath to hold the location of the database.
        string TempPath;

        TempPath = Server.MapPath("App_Data/AddressBook.mdb");

        //instantiate new clsDataLayer object.
        clsDataLayer oDataLayer = new clsDataLayer();

        //call the GetAllAddresses method and pass in TempPath for the argument.  returns a data set to be stroed in myAddressSet.
        dsAddress myAddressSet = oDataLayer.GetAllAddresses(TempPath);

        //assign the data source to the grid view from the data set.
        gvAddresses.DataSource = myAddressSet.tblAddressBook;

        //bind the grid view to the data source.
        gvAddresses.DataBind();

        //return the data set.
        return(myAddressSet);
    }