For -Beginners multiuser interface in delphi + ADO + Access

Hello!
I have Delphi, and  3 ADO  components (ADOConnection, ADOQuery, DataSource) and Quantium Grid from Devexpress (or standard DbGrid - it is not important). I put the Access DATAbase  file in a shared folder, made the components connection with each other, as shown in many examples for beginners in ADO and started working. Additionally I write a code to add and to remove records using standard ADOQuery methods. Not yet been realized multiuser interface - everything worked well. But now it needs to be done an
d I can not figure out how to approach this problem? 
Read many articles about LockType and CursorLocation - which I managed to achieve is (playing properties ADOQuery) - application works steadily on adding and editing data. But fails to work If you delete record from the DbGrid: if the other person does not update (and he can not do it because he do not know what kind of record has already been removed in the course of work to other user) application before changing a record, the program starts report errors and does not work.
One more thing: I do not understand the approach to solving this problem - does this mean that I have to decline the fill tables with data, and to transfer all the "manual mode"? For example, Dbgrid automatically writes the changed records to the database. Should I now take this process in my hands  to determine whether there is such a record? Or is there a semi-automatic (automatic) procedure?

*Maybe someone have an example?? Even elementary!* Internet has a lot of examples for getting started with ADO, but I have not found a single example of the beginning of the ADO in the multiuser interface.

Thank you!

Sorry for my English!
I am new to ADO, so the question may be elementary.
0
jiura
2/13/2013 4:42:57 PM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

2 Replies
986 Views

Similar Articles

[PageSpeed] 48

In article <547811@forums.embarcadero.com>,  (jiura LLL) wrote:

> I have Delphi, and  3 ADO  components (ADOConnection, ADOQuery, 
> DataSource) and Quantium Grid from Devexpress (or standard DbGrid - 
> it is not important). I put the Access DATAbase  file in a shared 
> folder,

Access is only loosely worthy of being called a database, and was never
designed for shared access, it's a single user desktop tool. 

Unless you need a massive database, Microsoft SQL Server Express has been
free for 10 years or so, and is a proper shared access database. 
 
> Maybe someone have an example?? Even elementary! Internet has a 
> lot of examples for getting started with ADO, but I have not found 
> a single example of the beginning of the ADO in the multiuser 
> interface.

Generally, you design your database and stored procedures to work around
sharing and multiple access issues, by adding locking Y/N columns,
incrementing version number columns, etc, and check if someone else is
modifying a record by Y or an old record version number. 

Angus
0
Angus
2/13/2013 5:50:12 PM
"jiura LLL" wrote in message news:547811@forums.embarcadero.com...
> I have Delphi, and  3 ADO  components (ADOConnection, ADOQuery, 
> DataSource) and Quantium Grid from Devexpress (or standard DbGrid - it is 
> not important). I put the Access DATAbase  file in a shared folder, made 
> the components connection with each other, as shown in many examples for 
> beginners in ADO and started working. Additionally I write a code to add 
> and to remove records using standard ADOQuery methods. Not yet been 
> realized multiuser interface - everything worked well. But now it needs to 
> be done an
> d I can not figure out how to approach this problem?
> Read many articles about LockType and CursorLocation - which I managed to 
> achieve is (playing properties ADOQuery) - application works steadily on 
> adding and editing data. But fails to work If you delete record from the 
> DbGrid: if the other person does not update (and he can not do it because 
> he do not know what kind of record has already been removed in the course 
> of work to other user) application before changing a record, the program 
> starts report errors and does not work.
> One more thing: I do not understand the approach to solving this problem - 
> does this mean that I have to decline the fill tables with data, and to 
> transfer all the "manual mode"? For example, Dbgrid automatically writes 
> the changed records to the database. Should I now take this process in my 
> hands  to determine whether there is such a record? Or is there a 
> semi-automatic (automatic) procedure?
>
> *Maybe someone have an example?? Even elementary!* Internet has a lot of 
> examples for getting started with ADO, but I have not found a single 
> example of the beginning of the ADO in the multiuser interface.


First, let's clear up some basics so you understand what is happening and 
what can be done.

The DBGrid (and all other data-aware controls) themselves do nothing other 
than notify other components that something has changed. When you change a 
field in a grid, it is the dataset (in this case TADOQuery) that is storing 
that changed value. Only when you call the Post method of the dataset do 
changes get written to the database. By default, simply by scrolling to 
another record in the grid, the TDatasource will cause a Post to happen on 
the linked dataset. Likewise, when you first edit a field in the grid (or 
other control), the datasource will place that record in Edit mode by 
calling Edit on the dataset.

So this opens up a couple of things you can do:

The dataset has BeforeEdit and BeforePost events. You can use either or both 
of these to execute code that checks to make sure the record being placed 
into Edit, or about to be Posted, still in fact exists. If it does not, you 
can call Abort or raise your own exception to cancel the operation let the 
user know - and also use that as a key to refresh the dataset. You should 
really only need to do this in the BeforeEdit event.

If you set the AutoEdit property of the TDatasource to false, that requires 
the user to explicitly click an Edit button you provide rather than being 
able to just start typing in the grid or other controls. That lets you check 
very easily at that point whether the record exists and/or refresh the grid 
before manually placing the dataset in Edit mode.

Now, the issue of automatically refreshing the display for other users when 
one user adds, changes, or deletes a record:
- there is no one single best way to do this no matter what database is 
being used. It is a standard problem. The easiest course of action is as 
above which is "optimistic" - let the user attempt to do what he wants and 
only check at that point. Actually you could take an even easier route - you 
can catch the errors that are coming up when a user attempts to edit a 
deleted record and simply present it in a more friendly manner, then refresh 
the dataset.

If you want to be more "pro-active" then there are several possibilities.
- the easy but somewhat expensive and efficient (thus the worst) way - 
automatically refresh the dataset periodically using a timer. If you have 
many tables that are displayed, this can get out of hand, and you also don't 
want to refresh a dataset if the user has it in edit or insert mode 
currently.

- if your database supports events (I don't believe Access does) then your 
application could hook into those to use as a trigger to refresh a dataset.

- you could make your application multi-tier. Instead of your application 
talking directly to the database, it could talk to another Delphi process 
you develop that runs as a server for all attached client applications. That 
way, when one user makes changes, it is quite easy to inform all other 
attached users through messaging. This also provides other opportunities 
such as caching some data that can improve performance. However it is a big 
subject on how to design it well, what "middleware" to use (DataSnap comes 
with Delphi but there are lots of 3rd party offerings as well).

-- 
Wayne Niddery (TeamB)
"To take from one, because it is thought his own industry and that of his 
fathers has acquired too much, in order to spare to others, who, or whose 
fathers, have not exercised equal industry and skill, is to violate 
arbitrarily the first principle of association, the guarantee to everyone 
the free exercise of his industry and the fruits acquired by it. -- Thomas 
Jefferson
0
Wayne
2/14/2013 3:54:03 PM
Reply:

Similar Artilces:

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

Delphi 6 to Delphi 2010 upgrade and ADO
We have an application written in Delphi 6 Professional that uses ADO to access databases servers that may be on other PCs in our network. We want to move to Delphi 2010 but can't decide if we need Professional or Enterprise. 2010 Pro has dbGO - will this give us the same functionality as the ADO components we use in Delphi 6 Pro? Thanks, Keith > 2010 Pro has dbGO - will this give us the same functionality as the > ADO components we use in Delphi 6 Pro? Yes. > {quote:title=Joachim Uersfeld wrote:}{quote} > > 2010 Pro has dbGO - will this give us the same func...

ASA7 ADO & Delphi ADO ?? Anyone is using it?
Any comments? Is it working? Any Problems? Thanks Hi, PR <noemail@no.com> schrieb in im Newsbeitrag: BoTThJaq$GA.89@forums.sybase.com... > Any comments? Is it working? Any Problems? I tried to connect to ASA7 via the new OLE DB - Provider and ADOExpress from Delphi 5.01. No chance. Only the error message 'Invalid Enum Value'. About the new provider I haven't heard anything good until now... Regards Frank Frank, I've experienced the same problem with the ASA 7 OLEDB Provider. I'm not sure if this is a bug in the AsaProvider or Delp...

Microsoft Access, ADO and One-to-Many relationship Delphi 2009
Microsoft Access I have an Access database with 2 tables: LakeMaps Table 1 LakeID: AutoNumber Name: Text County: Text Town: Text Area: Number MaximumDepth: Number MeanDepth: Number MapFilename: Number Species Table 2 Species: Text SpeciesID: Number LakeID is linked to SpeciesID in a One-To-Many relationship In Microsoft Access a form shows the lake information and species information in each lake correctly. Delphi 2009 A Delphi 2009 application with a TADOConnection, 2 TDataSource with 2 TADODatasets and 2 DBGrids ADOConnection1 the TADOConnection.Conn...

ASA7, ADO and Delphi
Hello! I've got a problem with accessing a database via ADO with Delphi 5. Everytime I set the ADOConnection active I get the error "Invalid enum value". I'm using Delphi 5 Enterprise and ASA7 with EBF #449. Is there anybody who ever get an ADOConnection to ASA7 with Delphi 5? Gruesse, Matthias I'm using C++ Builder 5 and get the same problem. I've asked this question before and no one seems to be able to respond... Matthias Hovestadt wrote: > Hello! > > I've got a problem with accessing a database via ADO > with Delp...

Delphi 5 with ADO
Hi I'm having some problems adjusting a Delphi5/MSSQL database application, which i did not wrote (what's more: i'm not a Delphi expert either) so i thought maybe someone in this comunity will enlighten me. It' about an SQL command which is issued by this delphi5 application (the sql command was traced in SQL server with profiler), but which is nowhere to be found in the souce code. I've searched already all the components which i knew that could issue the SQL command (TADOQuery, TADOCommand) but with no l uck. Could anyone tell me other misterious places where i shou...

Delphi + Long Binary + ADO
How can I update a long binary field in an ASA6 database using Delphi + ADO (not ADOExpress)? I have the blob in a string, but when trying to update the field, I get an "invalid variant conversion" error. If I re-type the field to a long varchar, the update seems to work, but I concerned that this may be affected by code page selection. Do I have to worry about raw bytes written to a long varchar not coming back in exactly the same form? From the database side of things, a LONG VARCHAR and LONG BINARY should be treated exactly the same way. I might try posting this ...

Delphi 2010, ADO and Datamodule
I installed Delphi 2010 on a Windows 7 x64. I have build a few applications using a datamodule and several Adodatasets, connecting to a SQL server. Until Delphi 2009 everything worked fine. When I open the project with 2010, I get an error, stating it can not find something, it probebly is not installed corectly. I tried reïnstalling without any succes. Projects with the sam AdO conecctions but no Datamodule run fine. Any sugestions? Regards, Kees Flipsen Kees Flipsen wrote: > I get an error, stating it can not find something, Do you really expect someone to be able...

System.ADO with Delphi debugger.
By 2 or 3 days Delphi debugger D7 , D9 and DXE stops with a System ADO fatal error (irretrievable error), when the program sets to True the ADOConnection's connected property. If the executable program run outside IDE the error does'nt raise, but when it starts inside IDE with debug option the error raise and the program stops and don't open the desired connection. I tried to repair MDAC on my system (Win32 XP SP3), but the problem remain. What can I do to use the debugger into IDE? (I use Delphi since 11 years and this problem never raised). Studio Rubabno Chairman wrote: &...

ADO to ADO.NET
I'm an ASP programmer (VBScript) moving on to ASP.NET. So far I'm using:Microsoft Visual Studio 2003ASP.NET with C#I'm working on converting my code over to C#, from VBScript. Now, here is my code in VBScript (modified to better understand it, this is a edited ugly version):Function ExecuteSQL(sqlStatement)    ConnDriver = "Provider=SQLOLEDB; Data Source = " & dbIP & "; Initial Catalog = " & dbName & "; User Id = " & dbUser & "; Password=" & dbPassword     Set connTemp = Server.CreateObject("ADODB.Connection")    c...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

ADO not ADO.NET
Hi, I have to connect to a db using adodb (which i select from the references). I have to retrieve the car models from the database and bind them to a listbox. I am not sure how to proceed and I can't find any articles on ADO with .net and data binding. Here is the code that i tried but it only retrieves the car model for the specified id. If I delete the id it doesn't work. Also it writes the car model in the listbox vertically such as: B M W CODE: Imports System.Data Imports ADODB Imports System.Data.OleDb Public Class listboxADO Inherits System.Web.UI...

ASA8 and Delphi ADO? Is it work?
Anybody test this configuration? As i can remember ASA7 don't work with Delphi via ADO. ---------------------------------- Oleg Kovalevsky Moscow, Russia I haven't tested ASA8 with Delphi, but I'm using ASA7 with Delphi 5 and ADOExpress. There are some glitches, but ASA support has been very helpful with addressing the problems. On Fri, 29 Mar 2002 17:01:05 +0300, "Oleg Kovalevsky" <okovalevsky@hotmail.com> wrote: >Anybody test this configuration? As i can remember ASA7 don't work with >Delphi via ADO. > > >----------...

Delphi, ADO, SQL Anywhere
This combination seem not to work together. I'm using D5 Enterprise, ASA 6.03 w/latest EBF On some tables it works. But most of the tables produce a message "An Error occured". As soon as data bound contols are used, the connection just gives errors. It seem to work fine, if I use client based cursors. But this option copys the server table to the local client. This is not acceptable for my large tables. It lasts several minutes on my pc. Are there plans to release a native OLE DB provider for ASA or at least to fix the ODBC driver so, that ADO can be used? I am very...

Access to legacy (Delphi 4) Midas server from Delphi XE2
Hello, My company biggest product is developped with Delphi 4 and uses several Midas servers. It's a really big application (still in evolution, since 1997) , that has been started with Delphi 3. A partial or complete rewrite of this application is planned in a mid term future, and I must study if we can envisage a soft migration of some parts of the software on Delphi XE2 (or XE4), or if a complete rewrite even of the servers parts is required. If a complete rewrite must be done, my boss doesn't exclude to study the possibility of using another development environment to rewri...

Web resources about - For -Beginners multiuser interface in delphi + ADO + Access - embarcadero.delphi.ado

Zen Mind, Beginner's Mind - Wikipedia, the free encyclopedia
Zen Mind, Beginner's Mind is a book of teachings by the late Shunryu Suzuki , a compilation of talks given to his satellite Zen center in Los ...

Bitcoin Beginners (@BTCBeginners) on Twitter
Log in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here Bitcoin Beginners @ BTCBeginners ...

German Vocabulary Free - Flashcards for Beginners & Kids on the App Store on iTunes
Get German Vocabulary Free - Flashcards for Beginners & Kids on the App Store. See screenshots and ratings, and read customer reviews.

Beginner's Bible Coloring Book! - Flickr - Photo Sharing!
Dad, did dinosaurs really exist? Sure they did, son. The Bible says so. They didn't call them &quot;dinosaurs&quot; back then, but instead they ...

Hatha Yoga For Beginners, A guide with 10 poses, details and benefits explained - YouTube
A video of beginners version of Hatha Yoga Sequence. 1. Let's start with easy Leg Raises: One leg is raised while the other remains flat on the ...

Second Test: Beginners' luck or Burns and Khawaja's time?
If Burns and Khawaja can bat positively with intent in the second Test like they did at the Gabba, we will see them in the side for years to ...

A Rugby World Cup beginners' guide: when to wake up and who to look out for
A guide on when to get up, who to look out for and what makes Sunday morning's showdown so special.

The Beginner’s Guide review: Failure is as failure does
... for entirely different reasons. Frankly, you won't find many video games who posit their creators as a lead character in the way that The Beginner's ...

COP21: Beginner's guide to the UN Paris climate summit
A background guide to the UN's major conference on climate change taking place in Paris until December 11.

A Beginner’s Guide To Star Wars
In case you haven’t heard, tomorrow is the release date of a little movie called Star Wars: Forced Awakening. Are you interested in seeing it, ...

Resources last updated: 12/20/2015 10:55:45 PM