Reputation: 1
I am trying to add a row to a table:
MYDataContext dc = new MYDataContext("MYConnectionString");
using (MYDataContext db = new MYDataContext("MYConnectionString"))
{
NotificationLog n = new NotificationLog();
n.result = result;
n.context = message;
n.tomobiles = phoneprefix + phone;
n.datesent = DateTime.Now;
n.SMSprovider = provider;
db.InsertOnSubmit(n);
db.SubmitChanges();
}
But I get this error:
'MYDataContext' does not contain a definition for 'InsertOnSubmit' and no extension method 'InsertOnSubmit' accepting a first argument of type 'MYDataContext' could be found (are you missing a using directive or an assembly reference?)
How I can fix that?
Upvotes: 0
Views: 575
Reputation: 8920
There is no InsertOnSubmit on the datacontext itsself. You need to add the entity. Something like:
db.NotificationLogs.InsertOnsubmit(n)
Upvotes: 0