Answer the question
In order to leave comments, you need to log in
Why does the error happen?
Good afternoon! I have a small problem: C
In general, here: the program has a ListBox and a ValueListEditor.
When you click on an item in the listbox, the data from the database is entered into the ValueListEditor.
When you click on another item, or just if you clicked again, then this one should be deleted and registered again.
THE CODE :
procedure TForm_Agents.ListBox1Click(Sender: TObject);
var
I: Integer;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('SELECT * FROM users WHERE nickname = @asas');
ADOQuery1.Parameters.ParamByName('@asas').Value := ListBox1.Items[ListBox1.ItemIndex];
ADOQuery1.Open;
while ValueListEditor1.Strings.Count > 0 do
ValueListEditor1.DeleteRow(ValueListEditor1.Row);
ValueListEditor1.InsertRow('ФИО',(ADOQuery1.FieldByName('fio').AsString),true);
ValueListEditor1.InsertRow('Никнейм',(ADOQuery1.FieldByName('nickname').AsString),true);
ValueListEditor1.InsertRow('Доступ',(ADOQuery1.FieldByName('level').AsString),true);
ValueListEditor1.InsertRow('Скайп',(ADOQuery1.FieldByName('skype').AsString),true);
ValueListEditor1.InsertRow('Нахождение',(ADOQuery1.FieldByName('location').AsString),true);
ValueListEditor1.InsertRow('Подробнее',(ADOQuery1.FieldByName('about').AsString),true);
ValueListEditor1.InsertRow('Взятые задания',(ADOQuery1.FieldByName('m_take').AsString),true);
ValueListEditor1.InsertRow('Выполенные задания',(ADOQuery1.FieldByName('m_complete').AsString),true);
ValueListEditor1.InsertRow('Штрафы',(ADOQuery1.FieldByName('penalty').AsString),true);
ValueListEditor1.InsertRow('Уникальный ID',(ADOQuery1.FieldByName('id').AsString),true);
end;
Answer the question
In order to leave comments, you need to log in
while ValueListEditor1.Strings.Count > 0 do
ValueListEditor1.DeleteRow(ValueListEditor1.Row);
take a closer look at this section of code,
"if you're too lazy to figure it out, the code works, and only bothers you with an error message,
wrap it in a try exception" -
bydlokoder's manual
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question