Free mag vol1 | Page 872

CHAPTER 21  ADO.NET PART I: THE CONNECTED LAYER Use the table editor to add four columns (CarID, Make, Color, and PetName) all of type varchar(50). Ensure that the CarID column has been set to the Primary Key (do this by right-clicking the CarID row and selecting Set Primary Key). Also, notice that all columns but CarID can be assigned null values. Figure 21-6 shows the final table settings (you don’t need to change anything in the Column Properties editor, but you should notice the data types for each column). Figure 21-6. Designing the Inventory table After you have created the table schema, save your work (via the Ctrl+S command or via File  Save). When you do so, you will be asked what to name your new table. In this case, name the table Inventory. After you are done, you should see the Inventory table under the Tables node of the Server Explorer. Adding Test Records to the Inventory Table To add records to your first table, right-click the Inventory table icon and select Show Table Data. Enter a handful of new automobiles of your choosing (to make it interesting, be sure to include some cars that have identical colors and makes). Figure 21-7 shows one possible list of inventory. 818