Ver Mensaje Individual
  #1  
Antiguo 26-06-2006
selmanc selmanc is offline
Registrado
 
Registrado: jun 2006
Posts: 3
Reputación: 0
selmanc Va por buen camino
Tengo problemas con IDataReader

Hola, estoy desarrollando una aplicación en Delphi 2005 para ASP.net, en un proceso necesito leer los registros de una tabla usando un IDataReader, cuando hago el proceso varias veces a través de un boton me marca el siguiente error:
Referencia a objeto no establecida como instancia de un objeto
Detalles de la excepción: System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto

Les envio el código donde me marca el error.

procedure TWebForm1.CargaAgenda;
var
Condicion: String;
sIni : string;
begin
IniciaAgenda;
fecha_seleccionada.Text := DateToStr(Calendar3.SelectedDate);
mensaje_dia_agenda_mostrada.Text := 'Agenda del ' + DiaSemana(Calendar3.SelectedDate) + ' ' + fecha_seleccionada.Text;
FSentencia := 'SELECT ID_MEDICO, ID_HORARIO, ID_PACIENTE, PACIENTE, NOTA, ESTATUS FROM AGENDA ';
sIni := FormatDateTime('mm-dd-yyyy',StrToDate(fecha_seleccionada.Text));
Condicion := '';
Condicion := ' WHERE (FECHA = ' + QuotedStr(sIni) + ') and (ID_MEDICO = ' + id_medico.Text + ')'; //;
with BdpC_Agenda do
begin
Connection.Open;
CommandText := FSentencia + Condicion;
lector := ExecuteReader;
while lector.Read do
begin
EscribeAgenda (lector.GetInt32(1), IntToStr(lector.GetInt32(2)), lector.GetString(3), lector.GetString(4), lector.GetInt16(5));
end;
lector.Close;
Connection.Close;
end;
end;
Responder Con Cita