Пустой ADOQuery при коннекте к Access2003
От: _SS  
Дата: 05.10.05 06:46
Оценка:
Имеем следующий кусок кода


try
DataSet1 := TADOQuery.Create(nil);
DataSet1.Connection := ADOConnection;
DataSet1.SQl.Add(SQL1);
DataSet.CommandType := cmdText;
DataSet1.Parameters.ParamByName('ID_QUERY').Value :=
DataSet.FieldByName('ID_Query').AsInteger;
DataSet1.Parameters.ParamByName('field').Value := Parameter;
//DataSet1.CursorType := ctStatic;
DataSet1.Open;
If not DataSet1.IsEmpty then
begin
Result := DataSet1.FieldByName('Was').AsString;
Exit;
end;


DataSet1.Close;
finally
FreeAndNil(DataSet1);
end;

Если результат запроса пустой, то в строке с DataSet1.Close получаем следующее исключение

Project 1.exe raised exception class EOleException with message 'Either BOF or EOF is True, or
the current record has been deleted. Requested operation requires a current record'. Process stopped.
Use Step or Run to continue.

Что это может быть и что с ним делать?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.