protected void SyncChangedAttachmentFolders() { string sel, hostpath, remotepath; //SFTPInterface sftpi = new SFTPInterface(); //sel = @"select LogX, ERefNo = null from _Attachments where changed = 1 union select LogX = null, ERefNo from _Attachments where changed = 1"; sel = @"select LogX, ERefNo from _Attachments where changed = 1"; AttachmentCollection changed = Attachments.GetCollection(sel); foreach (Attachment a in changed) { hostpath = GetHostPathToThisAttachment(a.Logx, a.ERefNo); remotepath = GetRemotePathToThisAttachment(a.Logx, a.ERefNo); int xxx = 0; xxx = SFTPInterface.SynchronizeAttachmentFolder(remotepath, hostpath); if (xxx == 0) { Attachment.ClearAttachmentChangedFlag(a); } } }