【发布时间】:2009-03-02 13:47:49
【问题描述】:
我一直在利用Scott Gu's tutorials on LINQ to SQL 尝试学习一些 LINQ。我已经能够查看、检索和更新记录,但无法将新记录写入数据库 (MSSQL)。 Scott 开始着手在教程集的fourth section 中插入行。正如您在该页面上看到的(或可能已经知道),要添加记录,您必须执行以下操作 (VB.NET):
Dim db as New LINQtoSQLDataContext
Dim oArticle as New article // table name
oArticle.Body = "Some Text"
oArticle.Title = "Some Title"
oArticle.Author = "Some Author"
db.articles.Add(oArticle) // this is the line that does not work.
Visual Studio 2008 向我返回“'add' is not a member of 'System.Data.Linq.Table(Of article)”。
谁能给我一个正确的方向?谢谢!
【问题讨论】:
标签: sql-server vb.net linq linq-to-sql