Databases Reference
In-Depth Information
Column Name
Data Type
Length
Allow Nulls?
UnitsInStock
smallint
2
Yes
UnitsOnOrder
smallint
2
Yes
ReorderLevel
smallint
2
Yes
Discontinued
bit
1
No
Try It Out: Using Typed Accessor Methods
Here, you'll build a console application that uses typed accessors.
1.
Add a new C# Console Application project named TypedAccessors to your
Chapter12 solution. Rename
Program.cs
to
TypedAccessors.cs
.
2.
Replace the code in
TypedAccessors.cs
with the code in Listing 12-3.
Listing 12-3.
TypedAccessors.cs
using System;
using System.Data;
using System.Data.SqlClient;
namespace Chapter12
{
class TypedAccessors
{
static void Main(string[] args)
{
// connection string
string connString = @"
server = .\sqlexpress;
integrated security = true;
database = northwind
";
Search WWH ::
Custom Search