Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   .NET (https://www.clubdelphi.com/foros/forumdisplay.php?f=17)
-   -   Tengo problemas con IDataReader (https://www.clubdelphi.com/foros/showthread.php?t=33062)

selmanc 26-06-2006 19:44:39

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;


La franja horaria es GMT +2. Ahora son las 05:40:22.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi