Database Reference
In-Depth Information
Set the Location property's X to 12 and Y to 12.
Set the ScrollBars property to Vertical.
Set the Size property's Width to 437 and Height to 290.
Set the Multiline property to True.
4. Now your TypedAccessor form in the Design view should look like Figure 14-5.
Figure 14-5. The Design view of the TypedAccessor form
5. Now double-click the empty surface of the TypedAccessor.cs form, and it will
open the code editor window, showing the TypedAccessor_Load event. Modify
the TypedAccessor _Load event to look like Listing 14-3.
Listing 14-3. TypedAccessors.cs
Using System.Data.SqlClient;
private void TypedAccessors_Load(object sender, EventArgs e)
{
// Connection string
string connString = @"server=.\sql2012;database=AdventureWorks;
Integrated Security=SSPI";
// Query
string sql = @"select CardType, CardNumber,ExpMonth,ExpYear from
Sales.CreditCard";
 
Search WWH ::




Custom Search