In this section, we will see how the OLE DB data provider can be used from .NET, through the features implemented in the System.Data.OleDb namespace.
The first thing we will do is to create a new Windows Forms Application project, using the default settings:
Let’s add create a CUBRID OLE DB connection in the Server Explorer. Expand Server Explorer window, select Data Connections, right-click and Add Connection:
Enter the CUBRID connection information: server, database, port, user, and password:
When you are done entering the connection information, click Test Connection, to make sure everything is ok and you can connect successfully to the database:
Now you will be able to browse the CUBRID demodb database from the Visual Studio Server Explorer window:
Note: Creating a CUBRID Connection in the Server Explorer is not a mandatory step; however, we recommend doing this because it provides additional advantages during development, like validating the CUBRID connection, easy browsing the database structure, testing your SQL queries etc.
Now let’s create a simple table data browser, for the historytable in the demodb database. Select Toolbox/Data/DataGridView and drag-drop it onto your form. You will be prompted to create a new DataSet/Data Source that will be associated with the DataGridView control:
Once we have created the DataSet, let’s choose the proper data source for the history table:
One last step -Run (F5 or Ctrl-F5). The application window will display the data from the history table:
...You have just created your first CUBRID .NET application using the CUBRID OLE DB Data Provider!