Ado table refreshing into a tread, error

Hi
I have made threat to refresh the tables:

procedure TCalcThread.Execute;
var
  t,n,DateTimeStart: extended;
    i:integer;
begin
  inherited;

  CoInitialize(nil); //CoInitialize was not called

  try

  while True do
   begin
    DateTimeStart:=now;
   // t:= now;
   // Seconds := Round((t-DateTimeStart)*24*60*60);

    i:=0;

    while i < 30 do //5min*60sek= 300 sek
    begin
    i:= Round((now-DateTimeStart)*24*60*60);
    ADOThreadedForm.Label1.Caption := IntToStr(i);
    end;
    //showmessage(inttostr(i));
     ADOThreadedForm.Label1.Caption := IntToStr(i);
     ADOThreadedForm.ADOTable1.DisableControls;
     ADOThreadedForm.ADOTable2.DisableControls;
     ADOThreadedForm.AdoTable1.Close;
     ADOThreadedForm.AdoTable1.Open;
     ADOThreadedForm.AdoTable2.Close;
     ADOThreadedForm.AdoTable2.Open;
     ADOThreadedForm.ADOTable1.EnableControls;
     ADOThreadedForm.ADOTable2.EnableControls ;
    end;
  finally
  end;
  CoUninitialize();
end; //TCalcThread.Execute;

on EnableControls method it crashes
with error message : EOSerror with message System error Code 5 
Access denied.
How should I solve this problem ???
0
Leposava
2/25/2009 10:56:18 AM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

3 Replies
536 Views

Similar Articles

[PageSpeed] 4

EnableControls and DisableControls will have an affect on components in the 
UI thread, which you cannot do from another thread. You should create thread 
methods to do this in Synchonize(), e.g.

procedure TCalcThread.EnableFormControls;
begin
  ADOThreadedForm.ADOTable1.EnableControls;
  ADOThreadedForm.ADOTable2.EnableControls;
end;

procedure TCalcThread.DisableFormControls;
begin
  ADOThreadedForm.ADOTable1.DisableControls;
  ADOThreadedForm.ADOTable2.DisableControls;
end;

Then in you thread's Execute() call:

Synchronize(DisableFormControls);
and
Synchronize(EnableFormControls);



"Leposava Knez" wrote in message news:85194@forums.codegear.com...
>
0
Andrew
2/25/2009 12:20:25 PM
Thanks, it works !!!!
0
Leposava
2/25/2009 1:22:25 PM
Great. Looking at your sample again - you shouldn't be setting label 
captions outside Synchonize() either.


"Leposava Knez" wrote in message news:85233@forums.codegear.com...
> Thanks, it works !!!!
0
Andrew
2/25/2009 2:52:26 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 ...

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...

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...

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...

Getting "Problem in Mapping Fragment starting at line ..." error when trying to create table mappings for table associations in ADO.NET Entity Framework
 Table A: COUNTRY_LOOKUP COUNTRY_ID   smallintclustered, unique, primary key located on PRIMARY    COUNTRY_ID TABLE B: COUNTRY_MODE_RULES CARRIER_ID    intMODE_RULE_TYPE_ID    intORIG_COUNTRY_ID    smallintDEST_COUNTRY_ID    smallint clustered, unique, primary key located on PRIMARY    CARRIER_ID, MODE_RULE_TYPE_ID, ORIG_COUNTRY_ID, DEST_COUNTRY_IDThere is a foreign key relationship from COUNTRY_MODE_RULES to COUNTRY_LOOKUPORIG_COUNTRY_IDREFERENCES .COUNTRY_LOOKUP (COUNTRY_ID)DEST_CO...

ADO and proxy tables on Access error
Hello, When I connect to a database in ado using the ASAProv for Adaptive Server Anywhere If I make a call NormalUser.Imp_ArtLst I have the following error VB : Err = -2147467259 Error = Une erreur g�n�rale s'est produite: Serveur serv_AllcompS : [Microsoft][ODBC Driver Manager] Function sequence error Here is the stored procedure Create Procedure NormalUser.Imp_ArtLst () On exception resume Begin For curs_Ass As curs_AccFor -- Ouverture du curseur CURSOR For Select ArtID , Flag , If dxf Is Null Then '' Else dxf Endif...

Delphi XE + TClientDataSet + ADO error
Hi, I have the error reported in this QC article: http://qc.embarcadero.com/wc/qcmain.aspx?d=88928 Anybody knows how to fix it ? Regards ...

Type Mismatch error when sorting ADO tables [Edit]
I have an app with a form with two dbgrids setup as master/detail. I placed two TGroupboxes with two radiobuttons each. One of the sets of radiobuttons sorts the Projects(master) dbgrid and the other sorts the Comments(detail) dbgrid. Both sorts are on a date field in the underlaying ADO tables. When I run the app, sorting just one of the dbgrids works fine until I try to click on the other dbgrid or the associated radiobuttons at which time I get the "Type Mismatch" error popping up. The ADO components are on a datamodule and are as follows: ADOConnection1 -> ADOTable_...

Opinions about ADO and ADO.NET
Hi everyone again!!! I´m used to develope applications with ADO, but now with .NET to develope a Web Application and a Mobile Web Application, I don't know if I have to use ADO.NET or continue using ADO. What Disadvantages has ADO to built Mobile Applications? In ADO I use ACCESS to create the .mdb files, Can I use .mdb files with ADO.NET? Thanks for all!! Go to ADO.NET NOW ! don't be late and you can use access in ado.net ADO.NET VB.NET/C#/ASP.NET/Oracle Designer 6i DotNet4Arab.com Building a custom web control(vb.net) Well, Thanks for your opinion, but I have...

Converting ADO to ADO.NET
Hi, I am trying to convert this code from ADO to ADO.NET I am very new to ADO.NET and am a bit confused on how I would convert this. Basically what I am trying to do is capture the name of the fields of a table to populate a dropdownlistbox. The table name will change every time the program is run. This is not a problem and I can code for that. Here is what I have in ADO (I have tried the wizard but it did not change the code) Dim tblFields As Object Dim myRst As New ADODB.Recordset Dim myField As ADODB.Field Dim myCnn As New ADODB.C...

ADO.NET VS ADO
Hi I am having ADO.NET course these days. I asked the instructor that developing online system like airline reservation system needs to a connected environment to lock/Unlock the table when u read/write to it Can that be acomplished using ado.net. His answer was no ADO.NET is only for disconnected environment and it will not work with online system and i still should use the old ADO. ADO.NET is not a replacment for ADO and both will continue in paralell. IS his answer true that ADO.NET will not replace ADO and both will continue Regards Check this link. Well ADO.NET is pa...

ADO to ADO.NET help
Hi, I am converting application ASP to ASP.NET.What is the equivalent code in ADO.NET. For each F in RS.Fields FieldName = F.Name Next Thanks, Nate If it is forward only, then you can use datareader for more info on this, check below link Datareader on MSDN Hope it helps!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti...

ado
Is anyone using ADO in PB 5.04 successfully? thanks! adam hodge ahodge@crowechizek.com ...

ADO
I have some problem to connect with transaction component to a ODBC LotusNoteSQL driver. I want to try with ADO component. I search some sample. Can you help me? Thank Thierry More info.... When I try to connect with transaction, and Select with Query, I have no problem with test button (I can see all my records) but in a form with any object (grid, listview ...) I see nothing !!! SOS, Heeeeelppppp meeeeeee Thierry ...

Web resources about - Ado table refreshing into a tread, error - embarcadero.delphi.ado

Moke (墨客) — A Refreshing Weibo Client (刷新你的微博体验) for iPhone, iPod touch, and iPad on the iTunes App Store ...
Get Moke (墨客) — A Refreshing Weibo Client (刷新你的微博体验) on the App Store. See screenshots and ratings, and read customer reviews.

NSW election: Leaders' conduct makes a refreshing change
One of the most encouraging things to come out of Saturday night was Luke Foley's apparent willingness to join Mike Bard in lifting political ...

Socceroos certain also-rans: how refreshing
Australia is the 62nd-ranked soccer country in the world. In the other team sports dearest to Australians' hearts, there are not even 62 countries ...

WAG culture: Mirka Federer made a refreshing change
It really shouldn't be headline news, not in 2014, but so faultlessly has Mirka Federer conducted herself in the five years she has been married ...

Refreshing taste of diplomacy
The Scandinavians are heading south.

Refreshing way to brew a sector newbie
Nexba: refreshing way to brew an iced tea sector newbie

Justin Trudeau's Abortion Tweet About Women Is Pretty Refreshing
At a time when it can feel like women's rights are being determined by people who aren't, frankly, affected by them, one Canadian politician ...

Tea's refreshing change
Li Jiayi and her friends are happy to spend 1,000 yuan between them over a pot of tea.

This ‘Refreshing’ Document Review Job Ad Is Actually Just Annoying And Unprofessional
Does this company want document review attorneys or “camp counselors?” Continue reading » Follow Above the Law on Twitter or become a fan on ...

Coke Zero Even Makes PowerPoint A Bit More Refreshing
... that’s enough to suspect it’ll get passed around the office by basketball lovers. The post Coke Zero Even Makes PowerPoint A Bit More Refreshing ...

Resources last updated: 12/27/2015 12:43:38 AM