vira1368
دوشنبه 24 تیر 1392, 15:05 عصر
سلام
توی برنامه میخوام اطلاعات رو وارد دیتابیس کنم از این کد استفاده کردم
try
{
testTBL t = new testTBL();
t.name = textBox1.Text;
t.family = textBox2.Text;
t.age = int.Parse(textBox3.Text);
db.testTBLs.AddObject(t);
db.SaveChanges();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
dataGridView1.DataSource = db.testTBLs.ToList();
مشکل اینجاست که وقتی میخواد insert کنه سر این خط:
db.SaveChanges();
این خطا رو میده:
Unable to update the EntitySet 'testTBL' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.
توی برنامه میخوام اطلاعات رو وارد دیتابیس کنم از این کد استفاده کردم
try
{
testTBL t = new testTBL();
t.name = textBox1.Text;
t.family = textBox2.Text;
t.age = int.Parse(textBox3.Text);
db.testTBLs.AddObject(t);
db.SaveChanges();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
dataGridView1.DataSource = db.testTBLs.ToList();
مشکل اینجاست که وقتی میخواد insert کنه سر این خط:
db.SaveChanges();
این خطا رو میده:
Unable to update the EntitySet 'testTBL' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.