If you run your application Delphi will restore the open
or closed
state that the dataset had in the Delphi form designer.
If there is an error Delphi can quitly drop this and close the dataset.
Also it’s possible that you accidently closed the dataset in the designer, after with it no longer auto-opens on ptogram start.
When it’s time to use the dataset you will get this error because the dataset is closed.
One option is to explicitly open the dataset in the FormCreate event and add error handling code there, this will allow you to see the error message and debug from there.
procedure TForm1.FormCreate(sender: TObject);
begin
try
MyDBFTable.Open;
except on exception e do
WriteErrorToLogFile('Cannot open MyDBFTable, error is: ' + e.message);
// or
//ShowMessage('Cannot open MyDBFTable, error is: ' + e.message);
end; {try}
end;
I always do opening of datasets explicitly in FormCreate because this allows me to log any errors. If a client app has an exception it gets emailed to me automatically.
Проблема: При нажатии на кнопку в программе появляется сообщение об ошибке.
Cannot perform this operation on a closed DataSet
Технические детали: На форме есть DataSet (если вы используете компоненты ADO, тогда это будет ADOQuery, ADOTable, Если UniDac — UniQuery, UniTable… В прочем это не играет большой роли для текущей ситуации). На кнопке был код, который обрабатывал некие данные находящиеся в DataSet’е, при обращении к нему появилась ошибка:
Cannot perform this operation on a closed DataSet
Инструментарий: Delphi XE
Решение: Проблема в том что мы пытаемся обратится к закрытому набору данных DataSet’а, для того чтобы решить данную проблемы пере обращением его нужно открыть.
DataSet.Active
Я к примеру использую процедуру для обновления DataSet’a, если DataSet открыт — обновляем, иначе открываем. Это не универсальное решение, но его можно использовать в большинстве случаев.
procedure RefreshDataSet(DataSet: TDataSet);
begin
if DataSet.Active then
DataSet.Refresh
else
DataSet.Open;
end;
Пример использования:
RefreshDataSet(ADOQuery1);
RefreshDataSet(UniQuery1);
SashaBucheR 0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 7 |
||||
1 |
||||
11.07.2013, 12:07. Показов 50401. Ответов 11 Метки нет (Все метки)
Добрый день! Есть такая проблемка: в наследство досталась программа, которая связывается с SQL сервером. Поставил вместо старого sql 2005 b поменял в ADOConnection путь. Теперь выдает ошибку: cannot perform this operation on a closed dataset (сама программа загружается и данные отображаются, это только когда начинаешь редактировать). В коде есть вот такая ерунда:
Пробовал и Integrated Security и через Юзера, толку нет. Самое интересное, что есть еще программа, которая работает с этой же базой, она работает полностью и редактировать данные можно. Где все-таки косяк? В Делфи или SQL (на сервере проверка подлинности стоит и Windows и SQl)?
__________________
0 |
476 / 390 / 111 Регистрация: 24.04.2012 Сообщений: 1,619 Записей в блоге: 3 |
|
11.07.2013, 12:31 |
2 |
cannot perform this operation on a closed dataset «невозможно выполнить операцию при закрытом наборе данных», т.е. при редактировании идет обращение к DataSet’у, а он в свою очерез закрыт. А этот код скорее всего с ошибкой никак не связян, т.к. это строка подключения к БД.
0 |
0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 7 |
|
11.07.2013, 13:37 [ТС] |
3 |
Я понял, что это строка подключения. Просто думал, что он подключается как-то с ограниченным доступом… Сейчас гляну DataSet. Вот только я слабоват… Нашел где DataSet, а что там проверить, прописать, чтобы он был открыт)
0 |
966 / 641 / 97 Регистрация: 01.11.2012 Сообщений: 1,447 |
|
11.07.2013, 15:01 |
4 |
SashaBucheR, попробуйте у всех Датасетов (ADOTable, ADODataSet, ADOQuery), которые были подключены к вашему ADOConnection изменить свойство Active на значение True.
0 |
0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 7 |
|
11.07.2013, 15:24 [ТС] |
5 |
Это во время CreateForm
0 |
0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 7 |
|
11.07.2013, 15:46 [ТС] |
6 |
Когда подключаюсь под sa сначала выдает такие две картинки. А потом опять «cannot perform this operation on a closed dataset»
0 |
476 / 390 / 111 Регистрация: 24.04.2012 Сообщений: 1,619 Записей в блоге: 3 |
|
12.07.2013, 05:12 |
7 |
Картинки это конечно хорошо, но еще бы и код немешало бы посмотреть, который их вызывает.
0 |
SashaBucheR 0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 7 |
||||||||
12.07.2013, 08:45 [ТС] |
8 |
|||||||
Выбивает на строке OpenADOTables
Добавлено через 36 минут
0 |
476 / 390 / 111 Регистрация: 24.04.2012 Сообщений: 1,619 Записей в блоге: 3 |
|
15.07.2013, 09:58 |
9 |
а код OpenADOTables?
0 |
SashaBucheR 0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 7 |
||||||||
16.07.2013, 11:11 [ТС] |
10 |
|||||||
В том коде, что открытие карточки, я поставил проверку состояния DataSet:
Выбивает Open, то есть, как бы Dataset активен…
0 |
Bit_Man 476 / 390 / 111 Регистрация: 24.04.2012 Сообщений: 1,619 Записей в блоге: 3 |
||||||||||||
17.07.2013, 10:03 |
11 |
|||||||||||
Выбивает на строке OpenADOTables Если так то проверяй Таблицы после открытия
выбивает при создании новой карточки
Добавлено через 3 минуты
??
0 |
0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 7 |
|
18.07.2013, 11:39 [ТС] |
12 |
Там действительно была проблема в таблицах. В ComboBox как-то DataSource сбились. Вот только теперь выдает «Exception class EDatabaseError with message: Circular datalinks are not allowed» при создании формы. Добавлено через 2 часа 22 минуты
0 |
Moderators: gto, EgonHugeist, olehs
-
marsupilami
- Platinum Boarder
- Posts: 1699
- Joined: 17.01.2011, 14:17
[solved] Cannot perform this operation on a closed dataset
Hello
I finally have my first testproject and have a problem. In most of my Projects I use a structure similar to this:
Code: Select all
ZConnection1.Connect;
ZConnection1.StartTransaction;
try
[do someting]
ZConnection1.Commit;
except
ZConnection1.Rollback;
end;
ZConnection1.Disconnect;
With Zeos 7 this raises an exception on commit: «XQuery: Cannot perform this operation on a closed dataset.», where XQuery is a closed query.
When the program subsequently tries to execute the rollback I get the exception «Invalid operation in AutoCommit mode».
Taking a look at the database, I see that the Transaction has been committed. But I wonder why the Connection would do anything to an inactive Query and why it does this after the commit?
This happens with the current version of http://svn.code.sf.net/p/zeoslib/code-0 … es/testing as well as with the latest version of http://svn.code.sf.net/p/zeoslib/code-0/trunk on Delphi XE2 and Firebird 2.1. The transaction isolation level is set to tiReadCommitted.
Best regards,
Jan
-
marsupilami
- Platinum Boarder
- Posts: 1699
- Joined: 17.01.2011, 14:17
Post
by marsupilami » 13.08.2012, 19:17
Hello,
The problem seems to have resolved itself somehow.
I am sorry for the trouble…
Best regards,
Jan
-
patyit
- Junior Boarder
- Posts: 37
- Joined: 10.02.2012, 18:39
Post
by patyit » 18.08.2012, 17:04
Hi all !
Jan is lucky, his problem is resolved itself !
But mine is not !
Lazarus 1.1, FPC 2.6.0, Zeos svn Testng (also Trunc) latest, Firebird 2.5
…
Database.StartTransaction;
try
Query1.ApplyUpdates;
Query2.ApplyUpdates;
Query3.ApplyUpdates;
Database.Commit; // <— Error message: ‘External: SIGSEGV’.
except
Database.Rollback;
… // error handling an back to edit data
Exit;
end;
QPrometz.CommitUpdates;
QPromett.CommitUpdates;
QPromet.CommitUpdates;
…
The full error message is :
Project RobFinPro raised exception class ‘External: SIGSEGV’.
In file ‘/home/patyi/lazarus-svn/zeos7_test/src/component/ZAbstractDataset.pas’ at line 641:
CachedResultSet.DisposeCachedUpdates;
I’m developing an ERP like (big) application and this code construction is very important !
I found bugreport for this : http://zeosbugs.firmos.at/view.php?id=206
Any progress ?
Best regards, Patyi
-
ism
- Zeos Test Team
- Posts: 202
- Joined: 02.10.2010, 20:48
Post
by ism » 18.08.2012, 17:26
Lazarus 1.1 ? What you want ?
On older stable versions of the same ?
Lazarus 1.0.8 fpc 2.6.0
-
ism
- Zeos Test Team
- Posts: 202
- Joined: 02.10.2010, 20:48
Post
by ism » 18.08.2012, 17:27
Lazarus 1.0.8 fpc 2.6.0
-
EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Post
by EgonHugeist » 19.08.2012, 11:44
patyit,
Nope i don’t think there was any further progress. Like i wrote on the BugReport i wanted to have some testers for the added code. I had no time to add a testcase to the testsuites we have. Maybe you can help me here?
Can you determime the SIGDEV?
Ism, he uses the new testing-branch on the other hand it would not be possible to have procedure DisposeCachedUpdates avialable, i think.
Michael
-
patyit
- Junior Boarder
- Posts: 37
- Joined: 10.02.2012, 18:39
Post
by patyit » 19.08.2012, 16:03
ism,
I’m using exactly that rev !
Michael,
I can write a small test application with data to demonstrate and test this bug.
I can test the changes, in test application and on production application with live data.
At least I can tell You it is ok or not.
By now : External: SIGSEGV when try to execute CachedResultSet.DisposeCachedUpdates
-
patyit
- Junior Boarder
- Posts: 37
- Joined: 10.02.2012, 18:39
Post
by patyit » 19.08.2012, 18:27
Some additional information :
I made a test, simulating wrong data witch is cause foreign key violation on ApplyUpdates, the changes is rolled back, and I can edit data correctly to solve the problem. It seams to Rollback is working correctly …
-
EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Post
by EgonHugeist » 19.08.2012, 19:23
patyit,
having a test-case would be fine. For me personally would it be the best help if you are able to add a test to our testsuites directly. So we can test the functionallity allways. However a test case or a patch to fix this issue would be great…
My thougths about the sequence the code should work now:
Take care TZConnection.AutoCommit = False and about the Transaction isolation levels…
try
Query1.ApplyUpdates;
Query2.ApplyUpdates;
Query3.ApplyUpdates; // <— Error message: ‘External: SIGSEGV’. This IS ok for me, if values are missing or the constraint cascade Rules making trouble! Btw. i implemented a TZQuery.Option doUpdateMasterFirst (only available with Zeos) which allows now to update a ForeignKey constraint in the MasterTable first and then all child-Tables.. (Here i allready made some tests and the work nice)
Database.Commit; //IF all Updates are done then this is not neccessary with Zeos if AutoCommit is True on the other hand it should work like expected.. I think this is the issue you want ot point me?!
except
Database.Rollback; //Roleback should dispose all done updates of the RowAccessor and calls DisposeUpdatesCh
… // error handling an back to edit data
Exit;
end;
QPrometz.CommitUpdates; // here i don’t understand you… Database.Commit should do this before.
QPromett.CommitUpdates;
QPromet.CommitUpdates;
Michael
-
patyit
- Junior Boarder
- Posts: 37
- Joined: 10.02.2012, 18:39
Commit error
Post
by patyit » 04.09.2012, 14:46
Hi all !
procedure TZAbstractConnection.Commit;
var
ExplicitTran: Boolean;
i: Integer;
begin
CheckConnected;
CheckNonAutoCommitMode;
ExplicitTran := FExplicitTransactionCounter > 0;
if FExplicitTransactionCounter < 2 then
//when 0 then AutoCommit was turned off, when 1 StartTransaction was used
begin
ShowSQLHourGlass;
try
try
// ***** rem by patyi *****
// for i := 0 to FDatasets.Count -1 do
// THack_ZAbstractDataset(FDatasets).DisposeCachedUpdates;
FConnection.Commit;
finally
FExplicitTransactionCounter := 0;
if ExplicitTran then
AutoCommit := True;
end;
finally
HideSQLHourGlass;
end;
DoCommit;
end
else
Dec(FExplicitTransactionCounter);
end;
I modyfied this procedure and seams to work good with fallowing program construction :
…
Database.StartTransaction;
try
Query1.ApplyUpdates;
Query2.ApplyUpdates;
Query3.ApplyUpdates;
Database.Commit; // earlier I got Error message: ‘External: SIGSEGV’.
except
Database.Rollback;
… // error handling an back to edit data
Exit;
end;
Query1.CommitUpdates; // this clear cached buffer,
Query2.CommitUpdates; // need because I’m modyfied the
Query3.CommitUpdates; // TZAbstractConnection.Commit procedure
…
As I said it works good, but I’m not shore about memory leaks …
-
EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Post
by EgonHugeist » 04.09.2012, 20:29
patyit,
ok this a sloution and an example to check the issue. I hope i’ll find the time next week to find out why THack_ZAbstractDataset(FDatasets).DisposeCachedUpdates; does raise exceptions.
-
EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Post
by EgonHugeist » 14.09.2012, 10:38
patyit,
I can do what i want. No way to reproduce the issue.
i use this code:
Code: Select all
procedure TZTestMasterDetailCase.TestClientDatasetWithForeignKey_ApplyUpdates;
var
SQLMonitor: TZSQLMonitor;
I: Integer;
procedure SetTheData(Index: Integer);
begin
MasterQuery.Append;
MasterQuery.FieldByName('dep_id').AsInteger := TestRowID + Index;
if Connection.UTF8StringsAsWideField or ( Connection.DbcConnection.GetEncoding = ceAnsi) then
MasterQuery.FieldByName('dep_name').AsString := 'öäüüäö'
else
MasterQuery.FieldByName('dep_name').AsString := Utf8Encode(WideString('öäüüäö'));
MasterQuery.FieldByName('dep_shname').AsString := 'abc';
if Connection.UTF8StringsAsWideField or (Connection.DbcConnection.GetEncoding = ceAnsi) then
MasterQuery.FieldByName('dep_address').AsString := 'A adress of öäüüäö'
else
MasterQuery.FieldByName('dep_address').AsString := Utf8Encode(WideString('A adress of öäüüäö'));
CheckEquals(True, (MasterQuery.State = dsInsert), 'MasterQuery Insert-State');
MasterQuery.Post;
DetailQuery.Append;
DetailQuery.FieldByName('p_id').AsInteger := TestRowID + Index;
DetailQuery.FieldByName('p_dep_id').AsInteger := TestRowID + Index;
if Connection.UTF8StringsAsWideField or (Connection.DbcConnection.GetEncoding = ceAnsi) then
DetailQuery.FieldByName('p_name').AsString := 'üäööäü'
else
DetailQuery.FieldByName('p_name').AsString := Utf8Encode(WideString('üäööäü'));
DetailQuery.FieldByName('p_begin_work').AsDateTime := now;
DetailQuery.FieldByName('p_end_work').AsDateTime := now;
DetailQuery.FieldByName('p_picture').AsString := '';
DetailQuery.FieldByName('p_resume').AsString := '';
DetailQuery.FieldByName('p_redundant').AsInteger := 5;
DetailQuery.Post;
CheckEquals(True, (DetailQuery.State = dsBrowse), 'MasterQuery dsBrowse-State');
CheckEquals(True, (MasterQuery.State = dsBrowse), 'MasterQuery dsBrowse-State');
end;
begin
//Connection.AutoCommit := False;
Connection.TransactIsolationLevel := tiReadCommitted;
Connection.StartTransaction;
SQLMonitor := TZSQLMonitor.Create(nil);
SQLMonitor.Active := True;
MasterQuery.SQL.Text := 'SELECT * FROM department ORDER BY dep_id';
MasterQuery.CachedUpdates := True;
MasterQuery.Open;
DetailQuery.SQL.Text := 'SELECT * FROM people';
DetailQuery.MasterSource := MasterDataSource;
DetailQuery.MasterFields := 'dep_id';
DetailQuery.LinkedFields := 'p_dep_id';
DetailQuery.CachedUpdates := True;
DetailQuery.Open;
SetTheData(0); //Add 1 line/DataSet
try
try
DetailQuery.ApplyUpdates; //-> crash because of the cascade rules
MasterQuery.ApplyUpdates;
Connection.Commit;
Fail('Wrong ApplayUpdates behavior!');
except
SetTheData(1); //Add some more lines
DetailQuery.Options := DetailQuery.Options + [doUpdateMasterFirst];
MasterQuery.ApplyUpdates;
DetailQuery.ApplyUpdates;
Connection.Commit;
CheckEquals(True, (MasterQuery.State = dsBrowse), 'MasterQuery Browse-State');
CheckEquals(True, (DetailQuery.State = dsBrowse), 'DetailQuery Browse-State');
MasterQuery.SQL.Text := 'delete from people where p_id = '+IntToStr(TestRowID+1);
MasterQuery.ExecSQL;
MasterQuery.SQL.Text := 'delete from department where dep_id = '+IntToStr(TestRowID+1);
MasterQuery.ExecSQL;
end;
finally
MasterQuery.SQL.Text := 'delete from people where p_id = '+IntToStr(TestRowID);
MasterQuery.ExecSQL;
MasterQuery.SQL.Text := 'delete from department where dep_id = '+IntToStr(TestRowID);
MasterQuery.ExecSQL;
SQLMonitor.Free;
end;
end;
Waht i’m doing wrong?
Edit:
issue confirmed and is not solvable (Each second cast of the AbstractDataSet uses a pointer to a IZCachedResultSet except DXE2 up) so i’ve added a difine to exclude this code.
Issue is gone. Patch done 1837
Confirmed?
-
patyit
- Junior Boarder
- Posts: 37
- Joined: 10.02.2012, 18:39
Post
by patyit » 20.09.2012, 23:02
Hi EgonHugeist !
I confirmed the issue is gone, at list on Lazarus 1.1, FPC 2.6.1, on XUbuntu,
Win XP and Win 7 tested with my live multiplatform application.
«Unfortunately» I don’t have Delphi (fortunately have Lazarus) that I can’t test under Delphi.
So now I don’t need to call CommitUpdates after Commit ?
Thank for help ! Patyi.
-
EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Post
by EgonHugeist » 21.09.2012, 05:12
patyit,
thank you for confirm the commit behavior.
So now I don’t need to call CommitUpdates after Commit ?
Yes that’s right. CommitUpdates did check the BrowseMode and Clear the Buffer.
Thought the Sequence should be handled like you and others did proprose and in this case CommitUpdates is a deprecated procedure.
Can you post something on Mantis to close this issue?
Через поиск в абд попробовал найти сотрудника. В строке поиска ввёл саба и на экране появилось предупреждение:недопустимое имя столбца саба. Я нажал ок и на экране новое предупреждение Cannot perform this operation on a closed dataset». До этого все работало хорошо. Сталкивались ли с подобным и как решали? 1 год 5 месяцев назад
#ссылка |
1 ответ
Помогла простая перезагрузка 1 год 5 месяцев назад
#ссылка |
Добавить ответ
Для добавления сообщений на форуме вам необходимо зарегистрироваться и указать мобильный телефон в своем профиле (зачем?)
ЗАДАН
1 год 5 месяцев назад
По каждому вопросу/ответу можно добавлять комментарии. Комментарии предназначены для уточнения вопроса/ответа.
Автор | Сообщение |
---|---|
Заголовок сообщения: Cannot perform this operation with a closed DataSet
|
|
|
Обнаружился баг, повторяется не всегда Анализ кода показал что проблема в недавно добавленном флаге FLayoutChangedInUpdateLock Порядок вызова обработчиков Если удалить код который относится к этому флагу все работает норм |
Вернуться наверх |
|
Administrator |
Заголовок сообщения: Re: Cannot perform this operation with a closed DataSet
|
||
|
Добрый день. Очень странные симптомы. Код: procedure TCustomDBGridEh.UpdateScrollBar; Попробуйте добиться эффекта на каком нибудь Демо проекте с подключением к стандартным таблицам стандартными ДатаСетами. Best regards _________________ |
||
Вернуться наверх |
|
||
alex_kart |
Заголовок сообщения: Re: Cannot perform this operation with a closed DataSet
|
|
Перед dataSet.Close ставится DisableControls, видимо из-за этого FDataLink.Active не отрабатывает нормально. Кроме того, поля датасета должны быть динамические, иначе при переоткрытии не вызовется Fields.Clear и, как следствие Notification с параметром opRemove Прикладываю демо проект: http://fileshare.in.ua/6106036 TmemTableEh + IBXDataDriver + FirebirdEmbedded |
Вернуться наверх |
|
alex_kart |
Заголовок сообщения: Re: Cannot perform this operation with a closed DataSet
|
|
Стоит ли надеяться на скорое решение этой проблемы?и |
Вернуться наверх |
|
Administrator |
Заголовок сообщения: Re: Cannot perform this operation with a closed DataSet
|
||
|
Добрый день. Не удается повторить ошибку на сборке EhLib 5.6 Build 5.6.227. У вас эта же сборка? Best regards _________________ |
||
Вернуться наверх |
|
||
alex_kart |
Заголовок сообщения: Re: Cannot perform this operation with a closed DataSet
|
|
У вас не получается повторить эту ошибку на тестовом проекте который я прикладывал? Цитата: Прикладываю демо проект: http://fileshare.in.ua/6106036 TmemTableEh + IBXDataDriver + FirebirdEmbedded Сборка была 224, скачаю 227, гляну |
Вернуться наверх |
|
Administrator |
Заголовок сообщения: Re: Cannot perform this operation with a closed DataSet
|
||
|
На тестовом проекте, как раз и проверяли. _________________ |
||
Вернуться наверх |
|
||
alex_kart |
Заголовок сообщения: Re: Cannot perform this operation with a closed DataSet
|
|
Проверил на билде 227, та же самая ситуация. Версии ОС на которых проверялось: |
Вернуться наверх |
|
|
|
|
Cannot perform this operation on a closed dataset!
- Подписаться на тему
- Сообщить другу
- Скачать/распечатать тему
|
|
Добрый день! Пишу небольшую базу данных на делфи! вроде все делаю правильно , но постоянно выходит ошибка Cannot perform this operation on a closed dataset! Работаю с компонентом kmemtable (позволяет создавать таблицу в памяти, выгружать и загружать). Вот сам код if od.Execute then begin sfCSV.CSVQuote:='»‘; sfCSV.CSVRecordDelimiter:=’,’; showmessage(‘1’); bdcomp1.Active:=true; bdcomp1.Open; if bdcomp1.Active then showmessage(‘îòêðûòà’); bdcomp1.LoadFromFileViaFormat(‘c:1.csv’,sfCSV); showmessage(‘îòêðûò111à’); dsbdcomp.DataSet:=bdcomp1; bdcomp1.Active:=true; end; Не смотрите что код кривой, просто я уже проверки делаю на активность базы. А ошибка выходит на строчке bdcomp1.LoadFromFileViaFormat(‘c:1.csv’,sfCSV); Сообщение отредактировано: Bas — 03.04.09, 05:39 |
Ahil |
|
Full Member Рейтинг (т): 9 |
Прежде чем стото делать с данными их надо открыть. (open or active=true). Компонент мне неизвестен. Что делает загрузка из файла? |
ximik666 |
|
так в том то и дело, что таблица открыта! Загрузка делает загрузку из специального файла! и добавление строчки проходит нормально! Сообщение отредактировано: ximik666 — 03.04.09, 05:53 |
Frees |
|
под дебагом зайди в процедуру LoadFromFileViaFormat и посмотри на чем он ломается |
ximik666 |
|
если несекрет как под дебагерром посмотреть? |
Frees |
|
поставь курсор на эту строку и нажми F5 |
ximik666 |
|
че то пока не могу разобраться! но ведь по идее таблица у меня открыта, почему может быть такая ошибка? Сообщение отредактировано: ximik666 — 03.04.09, 06:02 |
Ahil |
|
Full Member Рейтинг (т): 9 |
Ели bdcomp1 это набор данных то вам достаточно сделать опен. Потом посмотрите есть ли у этого компонента свойство reqwestlife (както так) и сделайте его труе. if od.Execute then begin sfCSV.CSVQuote:='»‘; sfCSV.CSVRecordDelimiter:=’,’; showmessage(‘1’); bdcomp1.Open; bdcomp1.reqwestlife:=true; //if bdcomp1.Active then showmessage(‘îòêðûòà’); bdcomp1.LoadFromFileViaFormat(‘c:1.csv’,sfCSV); showmessage(‘îòêðûò111à’); //dsbdcomp.DataSet:=bdcomp1; //bdcomp1.Active:=true; end; Добавлено 03.04.09, 06:12 |
ximik666 |
|
такого сойства у него нет! смое главное что добавление с помощью дбнавигатора проходит нормально |
Ahil |
|
Full Member Рейтинг (т): 9 |
Значит проблем в загрузке из файла. |
ximik666 |
|
укороче даже на чистой программе котороя ниже тоже выдает ошибку! procedure TForm1.FormCreate(Sender: TObject); begin with mem do begin Active := False; // òàáëèöà äîëæíà áûòü çàêðûòà // òåïåðü îïðåäåëÿåì ïîëÿ with FieldDefs do begin Clear; Add(‘fio’, ftString, 60, True); end; CreateTable; end; end; procedure TForm1.sBitBtn1Click(Sender: TObject); begin sfCSV.CSVQuote:='»‘; sfCSV.CSVRecordDelimiter:=’,’; mem.Open; mem.LoadFromFileViaFormat(‘c:1.csv’,sfCSV); mem.Active:=true; end; end. Сообщение отредактировано: Bas — 03.04.09, 06:55 |
Демо |
|
Что же всё-таки такое LoadFromFileViaFormat? |
ximik666 |
|
это процедура компонента kmemtable, которая позволяет загрузить файл определеннго формата! ну короче в этом файле хранится вся конфигурация и данные о виртуальной базе |
ximik666 |
|
Все всем спасибо вопрос решен! Теперь вопрос не по теме где можно посмотреть дизайны программ? ну для сравнения и чтобы для себя что нибудь взять! |
0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
0 пользователей:
- Предыдущая тема
- Delphi: Базы данных
- Следующая тема
[ Script execution time: 0,0398 ] [ 16 queries used ] [ Generated: 9.02.23, 08:34 GMT ]