Updating Data Directly to a Database

You have already seen how to issue queries directly to a database—now let's see how we can issue SQL commands that will perform record inserts or updates. To do this, we'll need to explore a little more of the fictional HR database that we have touched on previously. Let's suppose that the HR database holds, in addition to the employee table, a division table: Each employee belongs to a division of the company, and a division will have one or more employees working for it. The relationship, for those familiar with entity-relationship diagrams, is shown in Figure 15.2.

Figure 15.2. Entity relationship diagram: employee and division tables.

We should also go ahead and define the full schema for both the employee ...

Get Visual Basic® Programmer's Guide to the .NET Framework Class Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.