I had a code like this
dataset.DataVersion.AddDataVersionRow((开发者_运维百科new FileInfo(path + PermissionFile)).LastWriteTime.Ticks);
But when some changed it for getting some other functionality sometimes it is not working,i dont know why it is not working.This is the modified ,not working code
long version = (new FileInfo(path + PermissionFile)).LastWriteTime.Ticks;
if (dataset.DataVersion.Count == 0)
{
dataset.DataVersion.AddDataVersionRow(version);
}
else if (version > dataset.DataVersion[0].Version)
{
dataset.DataVersion[0].Version = version;
}
Do i need to add one more else loop here
Hard to answer without more information, but maybe you want to update the last entry in DataVersion:
int count = dataset.DataVersion.Count;
if (count == 0)
{
dataset.DataVersion.AddDataVersionRow(version);
}
else if (version > dataset.DataVersion[count-1].Version)
{
dataset.DataVersion[count-1].Version = version;
}
精彩评论