Solved

Controling table refresing when inserting records

Posted on 1997-07-14
10
145 Views
Last Modified: 2010-04-06
How can I keep a table updated for the users when records insertions occur and key duplication must be avoided?
Example: I have a medical calendar. Users want to set appointments for the same doctor on the same date. They check the calendar. The appointment doesn't exist yet. The first user sets the appointment. The second one should be able to see this in his screen. I've been trying the method 'refresh' but it doesn't work properly
thanks for advance.
0
Comment
Question by:anibal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
10 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338887
Refresch only rereads record, but the first user don't write the
record to disk. Try set property CachedUpdates to false.
If this don't work you must tell more about Database especially
about property UpdateMode and UpdateObject.

"....For more infomation on updating read-only datasets, see the chapter on "Working with cached updates" in the Database Application Developer's Guide....."

Good Luck
Mirek
0
 

Author Comment

by:anibal
ID: 1338888
If two users ,in a LAN, are inserting records with the same data at the same time how two avoid key duplication and how to keep th users informed when records are inserted?
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338889
You write  "...The second one should be able to see this in his screen. I've been trying the method 'refresh' but it doesn't work properly " so I say The first must save the record to disk, then the second can refresh !.
Key duplication if for you'r database engine.

I don't understand what you need.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:anibal
ID: 1338890
The problem is that the system is allowing insertion of identical records. I use Delphi 1.0 and I didn't find the method that you mentioned. Even using refresh before posting the record duplication occurs. I thought that bde would manage refreshing for all the station of the LAN when a table were edited.
Do you know how I could keep the users updated about the changes the tables suffer and how to avoid duplications of records when users try to insert 2 identical records at the same time?
Sorry for not being clear before.
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338891
Sorry I meen so i don't understand what you need (my english), but if i understand you must write code which check for duplication. You can do this in following sequence.

1.Try insert record
2. if duplication goto 4
3. All ok and goto END.
4. modify values which dulicates and goto 1.

If this is that what you want and you need code example then submit comment.
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338892
BDE can't do this for You.
0
 

Expert Comment

by:Wilfred
ID: 1338893
Another way of doing this (as a reaction to mireks comment) is to  
1. insert an empty record with the date in question set.
2. post it.
3. open & lock it so the user in question can edit it.
4. post again.

When user A is adding an appointment this date is blocked and no other users can add another appointment for this date until user A finishes.
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338894
when you will use SQL and Interbase then you can do this in some other way's.
0
 
LVL 3

Accepted Solution

by:
mirek071497 earned 100 total points
ID: 1338895
Hi anibal.

Sorry for my previous comment. I made mistake and this is not true.
BDE can do this for you.

The code is rather big so please get it from :
http://sunsite.icm.edu.pl/delphi/ftp/d10free/refresh.zip
This is free component and with full source. It use BDE-Callbacks to refresh TTable or TQuery if the dataset get modified by another program.

ps. I think that this is what you need so i submit answer.

Regard's
Mirek

0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1338896
Hi
is anybody there?
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question