Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Базы данных и репортинг > Cannot modify a read-only dataset Ошибка


Автор: Иван Человеков 5.5.2006, 19:57
BDE, Paradox.
Вот такой код:

автор    
Код

if not QFirms.Locate('name','',[]) then//Если нет пустой записи 
begin //Вставляем новую запись
QFirms.Insert;
QFirms.FieldByName('name').AsString:='';
QFirms.FieldByName('adress').AsString:='';
QFirms.FieldByName('unp').AsString:='';
QFirms.FieldByName('rs').AsString:='';
QFirms.FieldByName('bank').AsString:='';
QFirms.FieldByName('code').AsString:='';
QFirms.FieldByName('activ').AsBoolean:=false;
QFirms.FieldByName('bankID').AsString:=''; 
QFirms.Post;
end;


На Insert вылетает с ошибкой: "QFirms. Cannot modify a read-only dataset".
RequestLive=true.

Подскажите пожалуйста, что неверно. Спасибо. 

Автор: Fazil6 5.5.2006, 20:23
какой запрос у  QFirms? ORDER BY там нет? 

Автор: Иван Человеков 5.5.2006, 20:54
Fazil6,  ORDER BY убрал и получилось. Неужели в этом причина? 

Автор: Fazil6 5.5.2006, 21:08
Цитата

Single-table queries

Queries that retrieve data from a single table are updatable provided that:

There is no DISTINCT key word in the SELECT.
    Everything in the SELECT clause is a simple column reference or a calculated column, no aggregation is allowed. Calculated columns remain read-only.
    The table referenced in the FROM clause is an updatable base table.
    There is no GROUP BY or HAVING clause.
    There are no subqueries in the statement.
    There is no ORDER BY clause.
 

Автор: Иван Человеков 5.5.2006, 21:08
Fazil6,  спасибо в LOCALSQL.HLP нашёл smile 
Cпасибо за помощь smile

P.S. Если кому понадобится:
Код

Definition...

Single-table queries

Queries that retrieve data from a single table are updatable provided that:

There is no DISTINCT key word in the SELECT.
    Everything in the SELECT clause is a simple column reference or a calculated column, no aggregation is allowed. Calculated columns remain read-only.
    The table referenced in the FROM clause is an updatable base table.
    There is no GROUP BY or HAVING clause.
    There are no subqueries in the statement.
    There is no ORDER BY clause.

The read-only effect of an ORDER BY clause is negated and the query updatable if the ORDER BY clause uses a single column and there is a dBASE single-column primary or secondary index based on that same field. dBASE compound (expression) indexes will not negate the read-only effect of an ORDER BY clause. A Paradox single- or multi-field primary index will make the query updatable if the ORDER BY uses exactly the same columns (in the same order) as the index. Paradox secondary indexes will not negate the read-only effect of an ORDER BY clause.

Multi-table queries

All queries that join two or more tables will produce a read-only result set.

Calculated fields

For updateable queries with calculated fields, an additional field property identifies a result field as both read-only and calculated. Every call to the BDE function DbiPutField causes recalculation of any dependent fields.


Добавлено @ 21:08 
Одновременно получилось smile 

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)