Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

Database exclusive???

Here is my code:
         table.EmptyTable;

         while not tableID.Eof do begin
               table.Insert;
               tableNAME.AsString := tableIdBIRTHNAME.AsString;
               tableLAST.AsString := tableIdLAST.AsString;
               table.Post;
               tableId.Next;
         end;

my table called "Table" is set at exclusive = true in the property.
The thing is how do I do that if someone access the database in the sametime as another person that the person who connects to the database doesn't do the code I wrote above???
0
forzaMe
Asked:
forzaMe
  • 3
1 Solution
 
kretzschmarCommented:
if you set the table exclusive,
then no one else can use the table
after you open it
until you close it

you may not able to set the table exclusive,
if some one already accesses the table

but i understand your question not really,
could you explain?

meikl ;-)
0
 
forzaMeAuthor Commented:
What I meant to say is that, I want that when someone opens up the program, the program normally does the code I wrote above, but if someone else has also opened the program in the sametime,I want a popup message saying that it wont do that code, I dont know if you get what I mean.
0
 
kretzschmarCommented:
begin
  table.exclusive := true;
  try
    table.Open;
  except
    Showmessage('Sorry, can''t do that yet');
    abort;  //silent exception -> leaves this codeblock
  end;
  table.EmptyTable;
  while not tableID.Eof do
  begin
    table.Insert;
    tableNAME.AsString := tableIdBIRTHNAME.AsString;
    tableLAST.AsString := tableIdLAST.AsString;
    table.Post;
    tableId.Next;
  end;
  table.close;
end;

just as suggestion,
there may also other ways

meikl ;-)

0
 
kretzschmarCommented:
go here

http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

read there the paragraph
How Do I Know What Grade to Give?

and explain why you give a c-grade

meikl ;-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now