NeoDBpro Tutorial
Creating powerful database applications is relatively simple because NeoDBpro insulates you from much of the complexities of SQL. The steps below demonstrate how to open and display an existing MS Access database with NeoDBpro:
Getting Started
We recommend that you start with a new VisualNEO for Windows publication.
1. First you will need to use VisualNEO for Windows's Rectangle tool to define the location on the screen where you want the database's table grid to appear. To do this, simply select the Rectangle tool from VisualNEO for Windows's Tool Palette and draw a box on your publication. When your publication runs, the rectangle will be replaced by the table grid, so make sure that it is fairly large. After creating the rectangle, your screen should look like this:
2. Create a Push Button next to the rectangle.
3. Type Open in the Push Button's Caption property.
4. Click the Actions icon on the left side of the Push Button Properties dialog.
5. Click the Insert Action button.
6. Locate and select the NeoDBpro category among the icons on the left side of the Action Selector. If you don't see an icon for NeoDBpro, then you have not properly installed the plug-in. See Install Plug-Ins in VisualNEO for Windows's Options menu.
7. After selecting the NeoDBpro icon, select dbpOpenAccessDatabase from the right side of the screen. The following dialog box will appear:
8. The first parameter is the Database ID, which is simply a name that we will use to refer to this database in the future. It can be anything you like, but it's often easiest to use something short and descriptive. We'll use the ID later for other database commands.
For this tutorial, enter MyFirstDB in the Database ID field.
9. Next, type the name of the MS Access (*.mdb or *.accdb) file you want to display in the Database File Name field. If you don't know the name of the file you can click the small folder icon to the right of the field to select from a list. For this tutorial, we will use the sample AddressBook.mdb file included with this plug-in. You can find the AddressBook database in the following folder:
..\Documents\VisualNEO for Windows\NeoDBpro Samples\AddressBook\AddressBook.mdb
Enter this into the Database File Name field. If you installed VisualNEO for Windows or the plug-in in a different folder, then change the path above to reflect the location you selected.
Note: Since VisualNEO for Windows can't compile a database file inside your publication exe, you will need to take steps to insure that the file is included along with your finished project. The easiest way to do this is to make sure that the database is always placed in the same folder as your compiled publication, and replace the drive and path in the Database File Name field with VisualNEO for Windows's [PubDir] variable. For example, to open a database file named AddressBook.mdb, change the Database File Name field to:
[PubDir]AddressBook.mdb
At runtime, VisualNEO for Windows will automatically replace [PubDir] with the location of your compiled publication which should be the same as the location of your database file.
To insure that your publication also works when testing in VisualNEO for Windows, you can place a copy of your database file in the same folder as your uncompiled pub file.
10. If the database you selected is password protected, enter your password in the Password field. Otherwise, leave this field blank.
11. Click OK to assign the dbpOpenAccessDatabase action to the button.
12. Click the Insert Action button again.
13. Locate and select the dbpOpenTable action from the right side of the screen. The following dialog box will appear:
14. Enter MyFirstDB in the Database ID field.
15. If you defined the database correctly in step 9 above, you should be able to select Contacts from Table field combo box. If the table list is empty, then the Database File Name is probably incorrect. Go back to step 9 and correct the problem.
16. Click OK to assign the dbpOpenTable action to the button.
Note: After clicking OK, you may be asked: "Would you like to create text entry fields and labels for use with this table?" This is a very handy feature that you will find useful in the future, but for this tutorial you should answer "No" to this question.
17. Click the Insert Action button again.
18. Locate and select the dbpShowGrid action from the right side of the screen. The following dialog box will appear:
19. Enter MyFirstDB in the Database ID field.
20. Enter Contacts in the Table field.
21. In the Rectangle Object field, enter the name of the Rectangle object you created in step 1. You can also click the small gear icon to the right of the field and select the rectangle from a list.
22. Click OK to assign the pdfShowGrif action to the button. You should now have the following actions assigned to your Push Button:
dbpOpenAccessDatabase "MyFirstDB" "C:\Program Files\VisualNEO for Windows\PlugIns\NeoDBpro\Sample Pubs\AddressBook\AddressBook.mdb" ""
dbpOpenTable "MyFirstDB" "Contacts" ""
dbpShowGrid "MyFirstDB" "Contacts" "Rectangle1"
23. Click OK again to save the Push Button. Your screen should now look like this:
24. Let's test the publication. Select Run or Run (From Start) from the VisualNEO for Windows's Book menu.
25. Click the Open button to load and display the Contacts table. Your screen should look like this:
26. When you're finished testing, click the publication window’s Close button or press the Esc key on your keyboard.
To compile this publication, simply select Compile from VisualNEO for Windows's Book menu and compile as you would any other project. Then make sure to distribute both the compiled pub and the AddressBook.mdb file. See Distributing Database Publications for more information on this topic.