user962206
user962206

Reputation: 16117

Linq to MySql GetTable

I am trying to insert/add a data into my Database but it seems that this part of code won't work The name of the table that I am trying to add data on is "People"

Table<People> users = myDb.GetTable<People>;

Has an error on the Table<People> users why is this error occurring?? how would I fix this?

just in case you need the stack trace, here it is.

Error 1 The type or namespace name 'Table' could not be found (are you missing a using directive or an assembly reference?)
C:\Users\John\documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 23 13 WindowsFormsApplication1

Upvotes: 0

Views: 292

Answers (1)

DamienG
DamienG

Reputation: 6665

You need to add

using System.Data.Linq;

to the top of your file to bring the Table class into scope. Alternatively you could use:

var users = myDb.GetTable<People>();

Upvotes: 1

Related Questions