procedure TForm1.Button5Click(Sender: TObject);
var FF: TextFile;
begin
if opendialog1.execute then
begin AssignFile(FF,opendialog1.FileName);
reset(FF);
while not eof(FF) do
begin
readln(ff,’заглавие: ‘+ Datamodule2.ADOquery1.FieldByName(‘заглавие’).asstring);// ОШИБКУ ВЫДАЕТ НА ЭТОМ МЕСТЕ
readln(ff,’автор: ‘+ Datamodule2.ADOquery1.FieldByName(‘автор’).asstring);
readln(ff,’реферат: ‘+ Datamodule2.ADOquery1.FieldByName(‘реферат’).asstring);
readln(ff,’год издания: ‘+ Datamodule2.ADOquery1.FieldByName(‘год издания’).asstring);
readln(ff,’источник: ‘+ Datamodule2.ADOquery1.FieldByName(‘вид’).asstring);
readln(ff,’Âèä: ‘+ Datamodule2.ADOquery1.FieldByName(‘Âèä’).asstring);
readln(ff,’БДсайт: ‘+ Datamodule2.ADOquery1.FieldByName(‘БДсайт’).asstring);
readln(ff,’ИПС: ‘+ Datamodule2.ADOquery1.FieldByName(‘ИПС’).asstring);
CloseFile(FF);
end;
end;
This error message is given when you try to modify a read-only object such as a constant, a constant parameter, the return value of function, read-only properties, or fields of read-only properties.
There are two ways you can solve this kind of problem:
- Change the definition of whatever you are assigning to, so the assignment becomes legal.
- Eliminate the assignment altogether.
Examples
The previous example assigns to a constant parameter, to a constant, and to the result of a function call. All of these are illegal. The following example illustrates how to fix these problems.
In Delphi 2010 and above, E2064 is also emitted by the compiler whenever you try to assign a value to a member of a record exposed by a read-only property. Consider the following record type:
that is exposed by a read-only property in a class:
Assigning a value to either the CurrentCustomer property or to a member of the record exposed by the CurrentCustomer property results in the compiler emitting this E2064 error.
Проект находится по адресу: С:Project , в нем же находятся файлы file1.txt и file2.txt .
При попытке сбилдить проект, всплывает 3 ошибки. Не пойму почему?
[Pascal Error] E2064 Left side cannot be assigned to

1 ответ 1
Ошибка очевидна, вы пытаетесь присваивать новые значения константам. Сообщение вам об этом же и говорит: «Left side cannot be assigned to» — «нельзя присвоить значение левой стороне»
В Delphi также есть инструкция для компилятора, которая разрешит вам присваивать типизированным константам новые значения:
Она также доступна в настройках проекта Project -> Options -> Compiler -> Assignable typed Constants.