Database Reference
In-Depth Information
•
Leave the Text property blank.
4.
Now your FilterSort form in the Design view should look like Figure 15-5.
Figure 15-5. The
Design view of the FilterSort form
5.
Double-click the empty surface of the
FilterSort.cs
form, and it will open the
code editor window, showing the
FilterSort_Load
event. Modify the
FilterSort_Load
event to look like Listing 15-2.
Listing 15-2.
FilterSort.cs
Using System.Data.SqlClient;
private void FilterSort_Load(object sender, EventArgs e)
{
// Connection string
string connString = @"server=.\sql2012; database=AdventureWorks;
Integrated Security=true";
// Query
string sql1 = @" select *
from Production.Product
where Name Like 'Mountain%'";
string sql2 = @" select *
from Production.Location