Database Reference
In-Depth Information
Figure 18-6.
Adding References to Linq assemblies.
6.
Open the newly added form
LinqToSql.cs
in the Code view. Add the code
shown in Listing 18-2 in
LinqToSql.cs
.
Listing 18-2.
LinqToSql.cs
// Must add these two namespaces for LinqToSql
using System.Data.Linq;
using System.Data.Linq.Mapping;
[Table(Name = "Person.Person")]
public class Contact
{
[Column]
public string Title;
[Column]
public string FirstName;
[Column]
public string LastName;
}
private void LinqToSql_Load(object sender, EventArgs e)
{
// connection string