本文将为大家讲解LINQ to SQL访问后台数据库步骤,这也是LINQ方法的重要实现。希望本文能对大家有所帮助。
我们将用OpenXML SDK 2.0 for Microsoft Office (August 2009 CTP)来生成一个Word文档。我们要写一段程序来访问后台SQL Server数据库,并把返回的数据包在一个表里插入到一个已有的Word文档中。生成一个控制台程序并连接到后台数据库读取信息。
Create a Console Application and connect to AdventureWorks2008 Database
在这一步中,我们会:
◆生成一个控制台程序
◆生成一个LINQ to SQL类
◆测试连接后台数据库并读取信息In this task, we will
◆Create a console application
◆Create a LINQ to SQL class in the project
◆Validate the database connection by writing some data out to Console
1. 打开Visual Studio 2008:开始 | 所有程序 | Microsoft Visual Studio 2008 | Microsoft Visual Studio 2008
2. 在菜单里,选中文件|新建|项目…