Home > Back-end >  Delphi the TClientDataSet usage
Delphi the TClientDataSet usage

Time:10-06

SSQL:='select PlateNO,'
+ '(case CarOwnerType when' + QuotedStr (' N ') + 'then' + QuotedStr (' internal ')
+ + 's' QuotedStr (' Z ') + 'then' + QuotedStr () 'rent' + 'end'
As CarOwnerType, '+'
CarOwnerName, CarOwnerMobile, '+'
+ 'convert (varchar (30), BeginTime, 23) as BeginTime,'
+ 'convert (varchar (30), the EndTime, 23) as EndTime,'
+ '(case CarStatus when' + QuotedStr (' 1 ') + 'then' + QuotedStr (' normal ')
+ + 's' QuotedStr (' 0 ') + 'then' + QuotedStr (' expired) + 'end) as CarStatus,'
CarOwnerAddress, '+'
+ '(case UseMark when' + QuotedStr (' 1 ') + 'then' + QuotedStr (' enable ')
+ + 's' QuotedStr (' 0 ') + 'then' + QuotedStr (' disabled ') + 'end) as UseMark,'
+ 'Memo from T_CarAndOwnerInfo';
Procedure TDM. GetCDSBySQL (sSQL: string; Var aCDS: the TClientDataSet);
The begin
DataSetProvider1. The DataSet:=ADOQuery1;
With ADOQuery1 do
The begin
The CLOSE;
SQL. The CLEAR;
SQL. The ADD (sSQL);
The OPEN;
ACDS. Data:=DataSetProvider1. Data;
end;
end;
The question is: modify ACDS is always an error 'Field' CarOwnerType 'always be modified ";
Modify the code is as follows:
ACDS. Edit;
ACDS. FieldByName (' CarOwnerType). AsString:=sCarOwnerType;
ACDS. FieldByName (' CarStatus). AsString:=scarstatues;
ACDS. FieldByName (' UseMark). AsString:=susestatues;
ACDS. Post;
Great god please help a look, thank you!

CodePudding user response:

Said the code is complex, why don't you take a large section of the above functions use stored procedures, Delphi in the parameters of the call it!

CodePudding user response:


There is no problem as you write no hints but I is ORACLE

CodePudding user response:

CarOwnerType is excluded from the to field is not of you AS a real existence of the field, so I can't update

CodePudding user response:

Upstairs is the TClientDataSet is bound with database, CarOwnerType in real library has no real column so cannot update
  • Related