Arsip: Lock & UNlock ADOTable


by saysansay in Articles more 19 years ago 2718
Nech Artikel Buat Lock Table ADo Dan UnlocK Table ADO. Sumber www.delphi3000.com Tempat diriku main bareng kang cyber.....wakakaka
 Fungsi Lock
function lock(ds:TAdoConnection;LckTable:TAdodc;const  s:string;
rec,CurrentUserId:longint):boolean;
var
fnd:boolean;
s1:string;
begin
s1:=format(s,[trim(inttostr(rec))]);
LckTable.ConnectionString:=ds.ConnectionString;
LckTable.CursorLocation:=2;
LckTable.LockType:=2;
LckTable.CommandType:=2;
LckTable.RecordSource='Lock';
fnd:=false;
Try
LckTable.refresh;
if LckTable.Recordset.RecordCount>0 then
begin
LckTable.Recordset.MoveFirst;
LckTable.Recordset.Find('lockid='''+s1+'''',0,1,1);
end;
if LckTable.Recordset.RecordCount>0 then
if not (LckTable.Recordset.EOF) then
if LckTable.Recordset.Fields['lockid'].value=s1 then
fnd:=true;
if not fnd then
LckTable.Recordset.AddNew('lockid',s1);
LckTable.Recordset.Fields['fldEdt'].Value:=CurrentUserId;
result:=true;
except
result:=false;
end;
end;
Syntax Highlighted with https://pascal-id.org/syntax
Fungsi Unlock Fungsi UnlockTable
function Unlock(const s:string;rec:longint;LckTable:TAdodc):boolean;
var
s1:string;
begin
s1:=format(s,[trim(inttostr(rec))]);
try
LckTable.Recordset.Cancel;
LckTable.Recordset.Find('lockid='''+s1+'''',0,1,0);
LckTable.Recordset.Delete(1);
result:=true;
except
result:=false;
end;
end;
Syntax Highlighted with https://pascal-id.org/syntax
Download lengkap artikel disini http://www.geocities.com/saysansay/Lock.doc

Moga bermanfaat Wakakakakaka

AI Forward

๐Ÿš€ We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com