Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.


Now create a simple desktop application in Visual Studio and do the following.
Because this example uses a Microsoft Access database, add the System.Data.OleDb namespace at the top of the code.
You can now use the classes packaged under this namespace.
Now connect to the sample database to fetch and fill data into a DataSet object.
Bind the worksheet with the Products table of the DataSet:
Add the following code to the Bind Worksheet button’s click event.
The bound worksheet now loads data successfully but the column headers are labelled A, B and C by default. It would be better to set the column headers to the column names in the database table.
To set the column headers of worksheet:
Append the code written in the Bind Worksheet button’s click event with the following code snippet. By doing this the old column headers (A, B and C) will be replaced with ProductID, ProductName and ProductPrice.
To improve the look of the worksheet further, it is possible to set the width and styles of columns. For example, sometimes, the column header or the value inside the column consists of long number of characters that don’t fit inside the cell. To solve such issues, Aspose.Cells.GridDesktop supports changing the widths of columns.
Append the following code to the Bind Worksheet button. The column widths will be customized according to the new settings.
Aspose.Cells.GridDesktop also supports applying custom styles to columns. The following code, appended to the Bind Worksheet button, customizes the column styles to make them more presentable.
Now run the application and click the Bind Worksheet Button.
To add new rows to a worksheet, use the Worksheet class AddRow method. This appends an empty row at the bottom and a new DataRow is added to the data source (here, a new DataRow is added to the DataSet’s DataTable). Developers can add as many rows as they want by calling the AddRow method again and again. When a row has been added, users can enter values into it.
Aspose.Cells.GridDesktop also supports deleting rows by calling the Worksheet class RemoveRow method. Removing a row using Aspose.Cells.GridDesktop requires the index of the row to be deleted.
Adding the above code to the Delete Row button and run the application. A few records are displayed before the row is removed. Selecting a row and clicking the Delete Row button removes the selected row.
Finally, to save any changes made by users to the worksheet back to the database, use the OleDbDataAdapter object’s Update method. The Update method takes the data source (DataSet, DataTable etc.) of the worksheet to update the database.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.