Home > Back-end >  Delphi database into data and display the data problem!!!!!!
Delphi database into data and display the data problem!!!!!!

Time:10-01

Contact Delphi for some time, plexus contact Delphi to the database, has been inserted into the database after the show in the Dbgrid, before in Java and c # have a temporary data set as a temporary storage, such as, for example, there is a demand of the business logic, documents table and documents list, obviously is a one-to-many relationship, the subsidiary is in Delphi processing each is inserted into the database, and then, according to multiple subsidiary is more into then found out, according to

My question is, if you can, like Java or c #, there is a temporary storage place when the save or submit the documents, then the data into the database, so that we can save the number of database access, one could tell I use temporary table, is to establish a temporary table in the data, but will be a burden on the database access, frequent access database has certain pressure to the database and server,

I don't know what I can express hair eldest brother elder sister let you understand! To solve my doubt, genuflect is begged

CodePudding user response:

With a temporary object, this method is the most can think of

CodePudding user response:

Eldest brother how to use temporary objects, can detailed say a method to use?

CodePudding user response:

Using data sets TDataSet as a temporary table,

CodePudding user response:

The TClientDataSet is commonly used in imitation of MemTable to deal with,

CodePudding user response:

reference 4 floor frank_lee_cn response:
general to handle with the TClientDataSet imitation MemTable,

The eldest brother, gang help home, send Buddha to the home, can detailed explain method of use? I'm new here, don't know much about,

CodePudding user response:

reference lyhoo163 reply: 3/f
use TDataSet data sets as a temporary table,

The eldest brother can speak about the usage??

CodePudding user response:

Use the TClientDataSet component, the data in the TClientDataSet, authenticated in the database, the TClientDataSet similar buffer

CodePudding user response:

reference 5 floor yuebao353981348 reply:
Quote: refer to 4th floor frank_lee_cn response:

The TClientDataSet is commonly used in imitation of MemTable,

The eldest brother, gang help home, send Buddha to the home, can detailed explain method of use? I'm new here, don't know much about,


 
Type
TMemTable=class (the TClientDataSet)
Public
Procedure the Fill (aDataset: TDataSet);
The function Open: Boolean; Reintroduce;
end;
Implementation

{TMemTable}

Procedure TMemTable. The Fill (aDataset: TDataSet);
Var
I: Integer;
The begin
If the Active then
The Close;
FieldDefs. Assign (aDataset. FieldDefs);
The Open;
ADataset. First;
While not aDataset. Eof do
The begin
Append.
Try
For I:=0 to Fields. Do the Count - 1
Fields [I] Value:=aDataset Fields [I] Value;
The finally
Post;
end;
ADataset. Next;
end;
end;

The function TMemTable. Open: Boolean;
The begin
CreateDataSet;
Result:=Active;
end;



{
FMemTable:=TMemTable. Create (FQuery);

Or

FMemTable:=TMemTable. Create (nil);
FMemTable. The Fill (FQuery);

Or

FMemTable:=TMemTable. Create (nil);
FMemTable. FieldDefs. Add (" ID ", ftInteger, 0, False);
FMemTable. FieldDefs. Add (' Status' ftString, 10, False);
FMemTable. FieldDefs. Add (' Created ', ftDate, 0, False);
FMemTable. FieldDefs. Add (' Volume 'ftFloat, 0, False);

FMemTable. Open;
For I:=1 to 100 do
The begin
FMemTable. Append;
FMemTable. FieldByName (' ID '). AsInteger:=I;
FMemTable. FieldByName (' Status'). AsString:='Code' + IntToStr (I);
FMemTable. FieldByName (' Created '). AsDateTime:=the Date ();
FMemTable. FieldByName (' Volume '). AsFloat:=the Random (10000);
FMemTable. Post;
end;
}

CodePudding user response:

Didn't read it directly!

CodePudding user response:

The attention, will be used!

CodePudding user response:

With the call to write Demo appreciate receiving,

CodePudding user response:

refer to the eighth floor frank_lee_cn response:
Quote: refer to the fifth floor yuebao353981348 reply:

Quote: refer to 4th floor frank_lee_cn response:

The TClientDataSet is commonly used in imitation of MemTable,

The eldest brother, gang help home, send Buddha to the home, can detailed explain method of use? I'm new here, don't know much about,


 
Type
TMemTable=class (the TClientDataSet)
Public
Procedure the Fill (aDataset: TDataSet);
The function Open: Boolean; Reintroduce;
end;
Implementation

{TMemTable}

Procedure TMemTable. The Fill (aDataset: TDataSet);
Var
I: Integer;
The begin
If the Active then
The Close;
FieldDefs. Assign (aDataset. FieldDefs);
The Open;
ADataset. First;
While not aDataset. Eof do
The begin
Append.
Try
For I:=0 to Fields. Do the Count - 1
Fields [I] Value:=aDataset Fields [I] Value;
The finally
Post;
end;
ADataset. Next;
end;
end;

The function TMemTable. Open: Boolean;
The begin
CreateDataSet;
Result:=Active;
end;



{
FMemTable:=TMemTable. Create (FQuery);

Or

FMemTable:=TMemTable. Create (nil);
FMemTable. The Fill (FQuery);

Or

FMemTable:=TMemTable. Create (nil);
FMemTable. FieldDefs. Add (" ID ", ftInteger, 0, False);
FMemTable. FieldDefs. Add (' Status' ftString, 10, False);
FMemTable. FieldDefs. Add (' Created ', ftDate, 0, False);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related