views:

264

answers:

1

I have been utilizing Scott Gu's tutorials on LINQ to SQL to try to learn some LINQ. I have been able to view, retrieve, and update records but I am unable to write new records into the database (MSSQL). Scott starts getting into inserting rows in the fourth section of the set of tutorials. As you can see on that page (or may already know), in order to add a record you must do the following (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 returns me "'add' is not a member of 'System.Data.Linq.Table(Of article)".

Can anyone give me a push in the right direction? Thanks!

+6  A: 
db.articles.InsertOnSubmit(oArticle)
db.SubmitChanges()
John Boker
db.articles.InsertOnSubmit(oArticle)
Andrew Robinson
haha. the solution is always so simple and/or right in front of me. thanks
Anders