In this article, I do a test in WSS about using linq to read database.
What you need to do my test:
1. VS 2008 Beta2
2. Windows Server 2003 with WSS 3.0 installed
3. Sql Server 2005 or Sql Server 2005 express with Northwind database intalled.
Now, let's begin.
1. Configure the Web.config
First, you have to install .Net Framework 3.5. Then, you have to configure the web.config of your WSS web site. Just reference the file auto-generated by VS2008 Beta 2.
Pay attention to that: the trust level must be changed to Full.
<trust level="Full"/>
In the compilation elements, add following assemblies.
<compilation debug="false">
<assemblies>
<add assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
Out of the <system.web> elements, add these:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/warnaserror-" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" compilerOptions="/optioninfer+" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
</compiler>
</compilers>
</system.codedom>
2. Creating a C# class library project. In the project setting page, signing this project.

3. Create a LINQ Northwind Context, reference the Scott Gu' blog about how to to it.
http://weblogs.asp.net/scottgu/archive/2007/05/29/linq-to-sql-part-2-defining-our-data-model-classes.aspx
4.Create a class which inherit from System.Web.UI.WebControls.WebParts.WebPart
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.WebControls;
using System.Xml.Serialization;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

namespace GlenCode
5. Build the Project. Put the dll into the bin of the WSS extended Web.
6.In the webpart gallary of the site collection, populate the webpart.
7.Add the webpart to one of your web page.