Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microsoft CSharp Programming For The Absolute Beginner (2002) [eng]-1.pdf
Скачиваний:
46
Добавлен:
16.08.2013
Размер:
15.71 Mб
Скачать

Finally, I used the acceptChanges() method of dsSpy and the Update() method of adAgentSpec to update the database with the new values.

Notice that I placed all of the primary code for the method inside a try−catch block. This is because SQL queries can cause all kinds of debugging headaches and the try−catch structure makes it much easier to determine exactly what went wrong and how to fix it.

Summary

This chapter has introduced you to the world of data design. You have learned how to use the tools integrated into Visual Studio to create a custom database. You also have learned how to create normalized databases that prevent certain kinds of errors. You know how to use the data diagram tool to create relationships between tables, and you know how to build views and queries in the visual query tool. You also have learned how to attach these databases to your programs, both by dragging elements to the form and by hand. You’ve learned about ADO.NET’s disconnected architecture, and the objects used to access it. You built custom queries and used them to view, edit, and update data.

Challenges

Improve the SpyMaster database so the edit assignments and edit specialties screens use text boxes rather than data grids. In particular, do not let the user enter the primary key directly, but create it automatically.

Add a feature to the edit agents screen that enables the user to add a new agent.

Create a relational database to manage some kind of data in your life (grades, your music collection, or whatever). Build a program to manage the data.

Write an adventure game. Store the information about the dungeon, player, and monsters in a relational data structure.

374

Соседние файлы в предмете Программирование на C++