I have a model class shown below.
public class Section
{
[PrimaryKey]
public int section_id { get; set; }
public string name { get; set; }
public string url { get; set; }
public System.DateTime syncTime { get; set; }
}
When i try to update I get the error message as Cannot update Section: it has no PK
Below is my update Code
async public Task<bool> UpdateSection_SyncTime(int section_Id)
{
try
{
var sections = await db.Table<Section>().ToListAsync();
foreach (var section in sections)
{
if(section.section_id == section_Id)
{
section.syncTime = DateTime.Now; // Update the Section Sync Time
if (await db.UpdateAsync(section) >= 1)
return true;
}
}
}
catch { }
return false;
}
The exception is thrown in SQLite.cs file with the error.
Aucun commentaire:
Enregistrer un commentaire