This chart does not represent the real data yet. It is just a theoretical preview. So, double-click on the Load Data
button, which brings up the event handler in Default.aspx.cs
. Delete the Page_Load
stub. We'll start with the code shown in Figure 20.5.5 for this project:
Figure 20.5.5: The starting code for this project
The first thing is you have to add a namespace. So, go to the top of the file, and under using System
, enter the following:
using System.Data.SqlClient;
This line is used for connections and commands.
In the next stage, you need the connection string. So, on the following line you start by entering string connString =
, followed by the @
symbol to make it a verbatim string, and then you put the ""
symbols. Now, to get the connection string, do the following:
- Click on
View
in the menu bar, and selectSQL Server Object Explorer
. - Right-click on the
People
database, and selectProperties
. - In the
Properties
pane, double...