retriving 2 o more Date Fields in select statement

retriving 2 o more Date Fields in select statement

Postby lfmacias » Wed 12 Jul 2006 21:38

Hi,
This is the most weird that ever happened to me.

When i use a select statement like this.

"select id, destino, ";
sql += "mensaje, usuario, fecha_envio, fecha_pos, fecha_smsc,cliente, ";
sql += "id_smsc, id_estado from mensajes ";
sql += "where id_estado = @id_estado ";
sql += "order by usuario, fecha_pos, mensaje";


and use a DataReader object for retreiving those data including date values

command.CommandText = sql;
command.Parameters.Add("@id_estado",PgSqlType.Numeric).Value = idState;
messageReader = command.ExecuteReader();

while (messageReader.Read())
{
messageReader.GetDateTime(2) /*for retriving fecha_envio*/
/* and the fetching is ok por fecha_envio*/
messageReader.GetDateTime(3) /*fecha_pos for retriving */
/* Reader fails retrieving fecha_pos because 2 o more consecutive dates can not be retrieved consecutive*/
messageReader.GetDateTime(4) /* fecha_smsc for retriving */
/* Reader fails retrieving fecha_smsc because 2 o more consecutive dates can not be retrieved consecutive*/

}

Also if I use de function IsDBNull the same happens, the solution was mix others fields in the middle of Date Type Fields.
lfmacias
 
Posts: 3
Joined: Wed 12 Jul 2006 21:21

Postby Alexey » Thu 13 Jul 2006 07:35

Please provide me with your table definition and one insert statement to fill it.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for PostgreSQL