The begin
If Edit4) Text=Label40) Text then
The begin
CheckBox1. IsChecked:=False;
If (Edit1. Text<> ") and (Edit2. Text<> ") and (Edit3. Text<> "')
And (CalendarEdit1. Text<> ") and (Edit4. Text<> ") and (Length (Edit1. Text) & lt; 11)
And (Length (Edit1. Text) & gt; 5) then
The begin
ADOQuery1. Fieldbyname (' a '). Asstring:=Trim (Edit1. Text);
ADOQuery1. Fieldbyname (' b '). Asstring:=Trim (CalendarEdit1. Text);
ADOQuery1. Fieldbyname (' c '). Asstring:=Trim (Edit3. Text);
ADOQuery1. Fieldbyname (' d '). Asstring:=Trim (Edit2. Text);
ADOQuery1. Fieldbyname (' e '). Asstring:=Trim (label40. Text);
ADOQuery1. Fieldbyname (' f '). Asstring:=Trim (ComboEdit1. Text);
ADOQuery1. Fieldbyname (' g '). Asstring:=Trim (ComboEdit4. Text);
ADOQuery1. Fieldbyname (' h '). Asstring:=Trim (Edit5. Text);
ADOQuery1. Fieldbyname (' I '). Asstring:=Trim (Edit6. Text);
ADOQuery1. Fieldbyname (' j '). Asstring:=Trim (Edit7. Text);
ADOQuery1. Fieldbyname (' k '). Asstring:=Trim (Edit8. Text);
ADOQuery1. Fieldbyname (' l '). Asstring:=Trim (Edit9. Text);
ADOQuery1. Fieldbyname (' m '). Asstring:=Trim (Edit10. Text);
ADOQuery1. Fieldbyname (' n '). Asstring:=Trim (Edit11. Text);
ADOQuery1. Fieldbyname (' o '). Asstring:=Trim (Edit12. Text);
ADOQuery1. Fieldbyname (" p "). Asstring:=Trim (Edit13. Text);
ADOQuery1. Fieldbyname (' q '). Asstring:=Trim (Edit14. Text);
ADOQuery1. Fieldbyname (' r '). Asstring:=Trim (Edit15. Text);
ADOQuery1. Fieldbyname (' s) asstring:=Trim (Edit16. Text);
ADOQuery1. Fieldbyname (' t '). Asstring:=Trim (Edit17. Text);
ADOQuery1. Fieldbyname (' u '). Asstring:=Trim (Edit18. Text);
ADOQuery1. Fieldbyname (' v '). Asstring:=Trim (Edit19. Text);
ADOQuery1. Fieldbyname (' w '). Asstring:=Trim (Edit20. Text);
ADOQuery1. Fieldbyname (' x '). Asstring:=Trim (Edit21. Text);
ADOQuery1. Fieldbyname (' y '). Asstring:=Trim (Edit22. Text);
ADOQuery1. Fieldbyname (' z '). Asstring:=Trim (Edit23. Text);
ADOQuery1. Fieldbyname (' aa '). Asstring:=Trim (Edit24. Text);
ADOQuery1. Fieldbyname (" bb "). Asstring:=Trim (Edit25. Text);
ADOQuery1. Fieldbyname (' cc '). Asstring:=Trim (Edit26. Text);
ADOQuery1. Fieldbyname (' dd '). Asstring:=Trim (ComboEdit2. Text);
ADOQuery1. Fieldbyname (' ee '). Asstring:=Trim (Form3. Edit1. Text);
ADOQuery1. Post;
CodePudding user response:
Are you Insert or Edit? What kind of database, how many records in the table?CodePudding user response:
Don't see why this statement to eight seconds,CodePudding user response:
The above statement should be no big problemADOQuery1. Edit;//or Insert
.
ADOQuery1. Post;//should be paired with the above appear
Should be slow or your database, set up the data sorting, indexes, set up the unique ID, ADOQuery1 open data don't take too much at the same time,
CodePudding user response:
In the database insert need how longCodePudding user response:
No data access database, the database is empty,CodePudding user response:
Table to add a column on the unique ID, the primary key,CodePudding user response:
Can't, even if not to the primary key for that data will not need to 8 seconds, estimation is your database has a problem, you try run directly in the database,CodePudding user response:
Remember before the insert to disableControl database controlCodePudding user response:
Should be no index, you create an index, and set primary key should be ok!CodePudding user response:
Can't, 8 seconds is too long.CodePudding user response:
ADOQuery1. Post suggest not to use, use SQL statements to update is king,Such as' insert into tablename (a, b, c) values (... ) '
CodePudding user response:
Can you put the first the right values are placed into a temporary array [0.. I] of String on the left with ADOQuery1. Field [I] asstring, used for each assignment, the trim is function, should also accounts for the time when database operations,In addition to you so much IF judgment. Are they not written in the book of the ADOQuery1 Edit or Insert the front, not to judge when the data operation, best judgment before operation, all of the execution time,
CodePudding user response:
Direct use SQL statements to operation, INSERT INTOADOQuery1. Fieldbyname (' a '). Asstring:=Trim (Edit1. Text); This sentence is equivalent to the inside of the database records to find the time, and then return a valid field of pointer, this UNIT can be found in the DB
//code is 4172 lines in the DB unit,
The function TFields. FindField (const FieldName: string) : TField;
Var
I: Integer;
HashValue: Cardinal;
The begin
If FList. Count & gt; 0 then
The begin
HashValue:=TNamedItem HashName (FieldName);
For I:=0 to FList. Do the Count - 1
The begin
Result:=FList. Items [I];
If (Result. FFieldNameHashValue=https://bbs.csdn.net/topics/HashValue) and
(AnsiCompareText (Result. FFieldName, FieldName)=0) then
The Exit;
end;
end;
Result:=nil;
end;