一句简单的赋值语句,怎么会报下面的错误?
var
StrSql: AnsiString;
begin
StrSql:='Select Car.*,Rent.RentID,Rent.Begintime,Charge,Rent.Prepay,rent.Memo as rmm,rent.CustID,CustName,Tel,Customer.Memo as CMM from Car,Rent,Customer where State=''B'' and Car.CarID=Rent.CarID and rent.CustID=Customer.CustID and EndTime is null order by begintime';[Error] UnitReturn.pas(171): String literals may have at most 255 elements帮助文档里明明是这样写的啊:
A string represents a sequence of characters. Delphi supports the following predefined string types.
String types
Type Maximum length Memory required Used for
ShortString 255 characters 2 to 256 bytes backward compatibility
AnsiString ~2^31 characters 4 bytes to 2GB 8-bit (ANSI) characters, DBCS ANSI, MBCS ANSI, etc.
var
StrSql: AnsiString;
begin
StrSql:='Select Car.*,Rent.RentID,Rent.Begintime,Charge,Rent.Prepay,rent.Memo as rmm,rent.CustID,CustName,Tel,Customer.Memo as CMM from Car,Rent,Customer where State=''B'' and Car.CarID=Rent.CarID and rent.CustID=Customer.CustID and EndTime is null order by begintime';[Error] UnitReturn.pas(171): String literals may have at most 255 elements帮助文档里明明是这样写的啊:
A string represents a sequence of characters. Delphi supports the following predefined string types.
String types
Type Maximum length Memory required Used for
ShortString 255 characters 2 to 256 bytes backward compatibility
AnsiString ~2^31 characters 4 bytes to 2GB 8-bit (ANSI) characters, DBCS ANSI, MBCS ANSI, etc.
x是ansistring,而y是shortstring.超过255限制的不是x而是y...StrSql:='Select Car.*,Rent.RentID,Rent.Begintime,Charge,Rent.Prepay,rent.Memo as ';
StrSql:=StrSql+'rmm,rent.CustID,CustName,Tel,Customer.Memo as CMM from Car,Rent,Customer ';
StrSql:=StrSql+'where State=''B'' and Car.CarID=Rent.CarID and rent.CustID=Customer.CustID ';
StrSql:=StrSql+'and EndTime is null order by begintime';