Aspose.Cells.GridWeb.Examples.CSharp.Articles.BindDataUsingWorksheetDesigner.BindWithoutInSheetHeaders C# (CSharp) Method

BindWithoutInSheetHeaders() private method

private BindWithoutInSheetHeaders ( ) : void
return void
        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();
            }
        }