// http://stackoverflow.com/questions/2974868/what-is-the-syntax-in-linq-to-insert-a-record-using-objectset-instead-of-using // http://stackoverflow.com/questions/1011519/entity-framework-entitykey-foreign-key-problem public void InsertList(tblHtml htmlListObject) { // Create database context. //var ctx = new seleniumScrapeEntities(); //ctx.tblHtmls.AddObject(htmlListObject); //ctx.SaveChanges(); }
// Use similar to this below to create a new tblHTMLrow. public void AddHTMLtoList(string tableElementHTML) { // Add the scraped html to the list. var htmlData = new tblHtml { html_data = tableElementHTML, // Set the vehicle ID for the HTML Vehicle_id_fk = vehicleID, // Set the Time Stamp field Search_Date_Timestamp = DateTime.Now, // Set the search session Search_Session_ID_fk = searchSessionID }; // Add to db AddToDb(htmlData); }
private void AddToDb(tblHtml htmlData) { var addHtmlToDb = new CreateHTMLlist(); addHtmlToDb.InsertList(htmlData); }