← →
Sysoper
(2002-03-26 12:27)
[0]
Привет всем! Замучила ошибка «At end of table» при вызове метода ApplyUpdates для Query. В Query находятся «живые данные». Всего одна строка. Как с этим бороться? Может кто поборол
![]()
![]()
← →
Johnmen
(2002-03-26 12:30)
[1]
А поподробнее ?
![]()
![]()
← →
Sysoper
(2002-03-26 12:38)
[2]
Подробнее: В Query выбирается одна запись. Query имеет свойство CashedUpdates:=True, RequestLive:=True. После изменения данных вызывается метод ApplyUpdates. После этого выдается ошибка «At end of table». Данные есественно не сохраняются. НУ что так пойдёт?
![]()
![]()
← →
petr_v_a
(2002-03-26 15:24)
[3]
На BDE-ошибку «At end of table» отображается «родной» (native ) код возврата ф-ций API SQL-серверов, означающий, что выбирать из запроса больше нечего или DML-запрос не затронул ни одной записи.
См.под SQL-монитором.
![]()
![]()
← →
Johnmen
(2002-03-26 15:31)
[4]
А Query сделано Open ?
![]()
![]()
← →
sysoper
(2002-03-26 19:58)
[5]
Это всё понятно про ошибку,но как с ней бороться.Я так понимаю это BDE касячит.Query конечно открыто, Johnmen можешь не сомневаться
![]()
![]()
Hi guys.
I’m writing an app that connects to Access via BDE. This is access 97, I’m using Delphi 5, and the computer is windows 2000 using office XP (Maybe that’s where the problem is). I couldn’t convert the DB to access XP or access 2000 because then the BDE won’t connect to it (maybe there are new drivers or something?).
Anyway, I have a master-detail tables (2 tables). When I add a record to the master table, it works fine. If I add a record to the detail table, I get a ‘At end of table’ error after the POST command. I checked a 1000 times that all values in all fields in the table is correct (including the primary-key, I simply use a field called ‘number’ to diffrentiate).
What am I doing wrong???
Cheers,
Ron.
Здравствуйте уважаемые форумчане. При нажатии на кнопку у меня вылетает ошибка. Простенькая таблица, куда нужно вписать номер, количество людей и дату. Как убрать ошибку? И кстати как внести в таблицу дату? Что-то вроде ClientDataSet1.date.dd, ClientDataSet1.date.mm, ClientDataSet1.date.yy?
| Pascal | ||
|
Добавлено через 1 час 9 минут
Вообщем вместо edit append. А как с датами быть?
29th
Апр
Posted by obzor under Delphi
Использую sqlite3.pas для работы с БД sqlite.
Возник вопрос, как корректно обрабатывать случаи, когда в таблице не содержится требуемых данных?
Если в базе нет логина test1, то при попытке выполнения запроса получаю ошибку «table is at end of file». Как такую ошибку обработать? Не выполнять же в начале запрос на подсчет количества записей с таким логином, и если > 0 то выполнить запрос …
Stilet
s:integer;
...
s := sldb.GetTableValue('select count(users) from users where login = "'+login.Text + '" and pass="'+md5(pass.Text)+'"');
if s=1 then showmessage('Autorization ok!')
else showmessage('Autorization fail!');
тема на форуме
Похожие статьи
- Установить RadioButton в соответствии со значением в таблице базы данных
- Delphi — вывод всех данных с таблицы
- Суммировать данные
- Запретить ввод повторяющихся данных
- «Контроль версий» в структуре БД
- «Перемешать» данные в БД
- Вывод данных БД в Hint текста
- Сравнить весь столбец в таблице с текущим значением
- Удаление нескольких записей из БД
- Близкие контакты третьего вида с Visual Foxpro
Val Marinov seems to have given you a good answer to your question.
I just want to add
some points that don’t directly answer your question but may help you avoid making some mistakes.
You have some code
self.ListBox1.ItemIndex := Random(ListBox1.Items.Count)
which you want to use to set the listbox’s ItemIndex to a random, valid value. There are a couple of things which are asking for trouble about this:
1. Wrong way to use Random
The online help for the Random function says
In Delphi code, Random returns a random number within the range 0 <= X < Range. If Range is not specified, the result is a real-type random number within the range
0 <= X < 1.
For a ListBox, the range of valid ItemIndex values is 0..Items.Count - 1. But Random can return a fractional part, so a better way to write what you want is:
ListBox1.ItemIndex := Trunc(Random(ListBox1.Items.Count));
Called like that, Random will return a value below ListBox1.Items.Count, and the call to Trunc discards the fractional part.
2. Unnecessary use of self.
Your code is liberally sprinkled with the self qualifier. Having to use self like that is usually a sign of bad or sloppy coding.
In your TForm1.AddALL, the self in the first line tells the compiler that the instance of ListBox1 you are referring to is the one which is the TListBox component on your TForm1, rather than some other ListBox1 variable which may also be in scope (e.g. a global variable called ListBox1) when the line is compiled. But the way to avoid that problem is to avoid having the other ListBox1 in scope in the first place.
I suggest you simply delete all the instances of self., because you shouldn’t need to have them.
3. Avoid setting dataset RecordNumber
Finally, don’t get into the habit of relying on the fact that TClientDataSet allows you to specify a value for RecordNumber, it is rarely a good idea and few dataset types support it.
If you want to go to a random record, better use
Dataset.First;
DataSet.MoveBy(Random(X));
I leave it to you to work out what the argument X to Random should be, to move to a valid, random, record, based on what the online help says about Random.
