开发者

Version mismatch issue when using LastWriteTime.Ticks

开发者 https://www.devze.com 2023-02-13 07:27 出处:网络
I had a code like this dataset.DataVersion.AddDataVersionRow((开发者_运维百科new FileInfo(path + PermissionFile)).LastWriteTime.Ticks);

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号