English | 2015 | ISBN: 978-1-119-06566-1 | 600 Pages | EPUB | 10 MB
Quickly learn to program in C# programming with this unique book and video package
C# 24-Hour Trainer, 2nd Edition is your quick and easy guide to programming in C#, even if you have no programming experience at all. Updated to align with the latest C# standard, this book is your comprehensive beginner’s guide, with each lesson supplemented by a video, for over ten hours of video training. Each chapter focuses on a specific concept or technique, with detailed, easy-to-follow explanation followed by a hands-on exercise. The goals of each exercise are outlined in advance to help you understand what you’re working toward, and step-by-step instructions walk you through the operation from start to finish. Complex areas are clarified with specifically highlighted pointers that head off confusion, and additional exercises are provided so you can practice your new skills. Full instructor ancillaries are included to make this guide classroom ready, and the author’s own website offers ongoing support.
C# has become one of the most popular programming languages in the world, with millions of lines of code used in businesses and applications of all types and sizes. This book helps you dive right in so you can start programming right away.
- Start right in with the latest C# standard
- Learn at your own pace, with hands-on practice
- Clear up confusion and work around common obstacles
- Build your own Windows, .NET, and mobile applications
- C# has become a increasingly popular and in-demand programming skillsets. If you’ve decided to learn C#, this 24-Hour Trainer is your ultimate guide.
Note that this is an extremely simple example. Most real databases contain multiple tables. In that case, you can use the entity-relationship designer to model the relationships between the tables.
To add a relationship, right-click the designer’s surface, open the Add menu, and select Association. Select the parent and child classes from the dropdown lists and then select the fields that match up in the two classes.
For example, an Orders table might hold an OrderId field that you can use to find corresponding OrderItems records that make up the order. In that case, the parent class would be Orders, the child class would be OrderItems, and the fields that match up would be the OrderId fields in both classes.
After you build the association, the designer displays an arrow to represent the one-to-many relationship between the two classes (one Order may hold many OrderItems).
You can use similar steps to connect to other kinds of databases such as Oracle, MySQL, or Microsoft Access databases. Only the details needed to connect to the database in the Add Connection dialog are different. For example, Figure 37.2 shows the details needed for a Microsoft Access database, and Figure 37.4 shows the details needed for a SQL Server database.
Note that LINQ to SQL is intended to work with SQL Server and making it work with other types of databases takes some extra work. The section “Using LINQ to SQL with Access” later in this lesson explains how to use LINQ to SQL classes with Access databases, but there’s no guarantee that the same techniques will work with every kind of database or that those techniques will keep working in later versions of Visual Studio.
In the dialog shown in Figure 37.4, if you enter the name of a database that doesn’t exist on the server, Visual Studio tells you that the database doesn’t exist and asks if you want to create it. If you click Yes, you can use the Server Explorer to build the database. The Server Explorer doesn’t provide as many features as a database management tool such as SQL Server Management Studio, but it’s handy if you don’t have easy access to those tools.
By default, Visual Studio places new projects in your Projects folder at some obscure location such as C:UsersMyUserNameDocumentsVisual Studio 2016Projects. Later it can be hard to find these projects in File Explorer (for example, to make a copy).
To make finding projects easier, set the location to something more intuitive such as the desktop or a folder on the desktop. In fact, you might want to make a folder to hold projects for this book and then give each lesson a subfolder.
The next time you create a new project, Visual Studio will remember your last choice, so from now on it’ll be easy to find your projects.
Although the current time is sort of a piece of status information, don’t add a clock to the status bar. A user who wants a clock can display one in the system’s taskbar. The taskbar clock is more convenient because it provides options (such as display format) that you probably don’t want to reproduce in your program, and it also can’t be hidden by other programs. If the system provides a convenient tool, there’s no need for you to reproduce it in your program.
In addition to Windows Store apps, styles and dependency properties are available to WPF desktop applications. I just didn’t have room to cover them in earlier lessons.
You might remember that in Lesson 1, I said, “Normally you don’t need to worry about whether a feature is provided by Visual Studio, the C# language, or the .NET Framework.” That’s true here as well, but it’s informative to note that these dialogs are actually provided by the .NET Framework, not C#. That doesn’t change the way you use them, but it means they’re the same dialogs used by all .NET languages such as Visual Basic, Visual C++, or JScript.
By building these standard dialogs into the .NET Framework, Microsoft lets programmers using many languages share the same common features.