public void Insert(string tablewrite, RecordModell record) { using (var context = new tc_dataCollectionContext()) { context.ConnectionString = ConnectionString; context.DBMS = "SQLite"; context.Tablename = tablewrite; context.Chambers.Add(record); context.SaveChanges(); } Console.WriteLine("record successfully inserted to : " + tablewrite); }
public void Insert(string tablewrite, RecordModell record) { using (var context = new tc_dataCollectionContext()) { // context.ConnectionString = ConnectionString; context.DBMS = "MySQL"; context.ConnectionString = ConnectionString; context.Tablename = tablewrite; context.Chambers.Add(record); try { context.SaveChanges(); } catch (Exception) { Console.WriteLine("error inserting to MySQL DB"); throw; } } Console.WriteLine("record successfully inserted to : " + tablewrite); }