2014-01-29 28 views
0

傳遞一個POSUnitRecords列表。我試圖訪問數據庫'EPOSEntities'中的表'記錄'。 Foreach POS我想在'Records'表中添加另一行。訪問數據庫表和列表中的每個記錄在表中創建一個新列

public static void UpdateDataBase(List<POSUnitRecord> POSs) 
     { 
      EPOSEntities db = new EPOSEntities(); 
      var ent = from epos in db.Records 
         where epos. 
         //Columns in 'Records' table are 'Id' & 'Folder' 

      foreach (POSUnitRecord pos in POSs) 
      { 
       //fields in pos are 'Id' & 'Folder' 

      } 
     } 

////////////////////////////////

public class POSUnitRecord 
{ 
    //[Key] 
    public int Id { get; set; } 
    public virtual string FolderPath { get; set; } 

} 
+0

是什麼'POSUnitRecord'類看起來像? – ekad

+0

我得到'Foreach POS'我想在'Records'表中添加另一行',但我不確定'Im試圖訪問db'EPOSEntities'中的'Records'表意味着什麼,你能詳細說一下嗎? – ekad

回答

0
public static void UpdateDataBase(List<POSUnitRecord> POSs) 
     { 
      EPOSEntities db = new EPOSEntities(); 
      var ent = from epos in db.Records; 
         //where epos. 
         //Columns in 'Records' table are 'Id' & 'Folder' 

      foreach (POSUnitRecord pos in POSs) 
      { 
       Record aRecord = new Record(); 
       aRecord.Id = pos.Id; 
       aRecord.Folder = pos.FolderPath 
       aRecord.New="put your value"; 
       ent.Add(aRecord); 
      }    
    } 
相關問題