entity framework 6 - Inserting or adding a string to a database table using linq to SQL and EF6? -
i'm trying learn linq sql , entity framework 6. trying add strings database table.
here i've got now:
static void main(string[] args) { using (responsesentities db = new responsesentities()) { try { respons res = new respons(); res.extserial = "asdf1234"; res.date = "2015-05-01"; res.filename = @"c:\tae.xml"; res.responsedescription = "ok"; db.responses.add(res); console.writeline("inserted!"); console.readline(); } catch (exception) { console.writeline("tae! error"); } }
it runs won't add strings table.
you're adding object in-memory store - need persist changes database!
db.responses.add(res); db.savechanges(); // write changes database
Comments
Post a Comment