Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Unable to set exclusive
Sun, Oct 5 2008 5:44 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

This ZapInMemoryTable(ivp); generates this


---------------------------
Debugger Exception Notification
---------------------------
Project TfR.exe raised exception class EEDBError with message 'ElevateDB Error #300 Cannot lock the table ivp for exclusive access'.
---------------------------
Break   Continue   Help  
---------------------------


I tried un-commenting "//     WhichTable.Exclusive := True;" and that line is happy to set exclusive.


function DoesTableExist(chk: TnlhTable): boolean;
var
Checker: TEDBQuery;
begin
Checker := TEDBQuery.Create(nil);
try
 Checker.SessionName := chk.SessionName;
 Checker.DatabaseName := chk.DatabaseName;
 Checker.SQL.Text := 'SELECT * FROM Information.Tables WHERE Name = ' + QuotedStr(chk.TableName);
 Checker.ExecSQL;
 Result := Checker.RecordCount > 0;
finally
 Checker.Close;
 Checker.Free;
end;
end;

procedure ZapInMemoryTable(WhichTable: TnlhTable; ZapComponent: boolean = True);
var
Zapper: TEDBQuery;
begin
Zapper := TEDBQuery.Create(nil);
try
 try
  if Assigned(WhichTable) and DoesTableExist(WhichTable) then begin
   WhichTable.DisableControls;
   try
    WhichTable.Close;
//     WhichTable.Exclusive := True;
    Zapper.SessionName := WhichTable.SessionName;
    Zapper.DatabaseName := WhichTable.DatabaseName;
    Zapper.SQL.Text := 'DROP TABLE ' + WhichTable.TableName;
    Zapper.ExecSQL;
    Zapper.Close;
   finally
    if ZapComponent then FreeAndNil(WhichTable) else WhichTable.EnableControls;
   end;
  end;
 except
 end;
finally
 Zapper.Free;
end;
end;


Roy Lambert
Mon, Oct 6 2008 7:43 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


Eventually found what was causing it. I have a query

SELECT DISTINCT
CAST (_StartPoint AS DATE) AS ivpDate
FROM ivp
ORDER BY ivpDate

which I had to close. But the point still remains - why could I set exclusive to true using the table component, but the query couldn't to drop it?

Roy Lambert
Mon, Oct 6 2008 9:12 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Sussed it. I was setting exclusive, but not opening the table - now it bombs out on that. Next bit is trying to figure out what's changed in the TMS planner since I last worked on this form Frown

Roy Lambert
Image