private void BindWithoutInSheetHeaders()
        {
            // Create dataset object
            this.dataSet11 = new DataSet1();

            // Create database object
            ExampleDatabase db = new ExampleDatabase();

            // Create path to database file
            string path = (this.Master as Site).GetDataDir();

            // Create connection string
            db.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + "\\Miscellaneous\\Database\\demos.mdb";
            try
            {
                // Connects to database and fetches data.
                db.oleDbDataAdapter1.Fill(dataSet11);

                // Create web worksheet object
                WebWorksheet sheet = GridWeb1.WebWorksheets[0];

                // Clears the sheet.
                sheet.Cells.Clear();
                sheet.Cells.UnMerge(0, 0, 2, 11);

                // Disables creating in-sheet headers.
                sheet.EnableCreateBindColumnHeader = false;

                // Data cells begin from row 0.
                sheet.BindStartRow = 0;

                // Unfreezes the header rows.
                sheet.UnfreezePanes();

                // Bind the sheet to the dataset.
                sheet.DataBind();
            }
            finally
            {
                // Close database connection
                db.oleDbConnection1.Close();
            }
        }
示例#2
0
    private void BindWithoutInSheetHeaders()
    {
        //Create database object
        this.dataSet11 = new Aspose.Cells.GridWeb.DemosCS.DataBind.DataSet1();

        //Create demo database object
        DemoDatabase db = new DemoDatabase();

        //Create path to database file
        string path = Server.MapPath("~");

        path = path.Substring(0, path.LastIndexOf("\\"));

        //Create connection string to database file
        db.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + "\\Database\\demos.mdb";
        try
        {
            // Connects to database and fetches data.
            db.oleDbDataAdapter1.Fill(dataSet11);

            //Create web worksheet object
            WebWorksheet sheet = GridWeb1.WebWorksheets[0];

            // Clears the sheet.
            sheet.Cells.Clear();
            sheet.Cells.UnMerge(0, 0, 2, 11);
            // Disables creating in-sheet headers.
            sheet.EnableCreateBindColumnHeader = false;

            // Data cells begin from row 0.
            sheet.BindStartRow = 0;
            // Unfreezes the header rows.
            sheet.UnfreezePanes();
            // Bind the sheet to the dataset.
            sheet.DataBind();
        }
        finally
        {
            //Close database connection
            db.oleDbConnection1.Close();
        }
    }