problem with Timestamp parameter

problem with Timestamp parameter

Postby micdearmas » Mon 28 Aug 2006 19:52

Hi,

I'm getting an error when I try to update a field of type Timestamp using a command and parameters.

StringBuilder myQuery = new StringBuilder("UPDATE myschema.mytable " +
"SET last_time = @last_time");

PgSqlCommand pgCmd = new PgSqlCommand(myQuery.ToString(), _pgConnection_Main);
pgCmd.Parameters.Add("@last_time", PgSqlType.TimeStamp).Value = DateTime.Now;
pgCmd.ExecuteNonQuery();


I get the error "date/time field value out of range"

However, if I try, for example:

StringBuilder myQuery = new StringBuilder("UPDATE myschema.mytable " +
"SET last_time = '2006-08-25 13:51'::timestamp");
PgSqlCommand pgCmd = new PgSqlCommand(myQuery.ToString(), _pgConnection_Main);
pgCmd.ExecuteNonQuery();

Everything works fine in this case. Any ideas what's wrong when I use parameters? I have tried

pgCmd.Parameters.Add("@last_time", PgSqlType.TimeStamp).Value = DateTime.Now;
and
pgCmd.Parameters.Add("@last_time", PgSqlType.TimeStampTZ).Value = DateTime.Now;

but I still get the problem.


I'm using
PostgreSQLDirect .NET Data Provider 2.40.13.0
and the DB is PostgreSQL 8.0.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)

Thanks.
micdearmas
 
Posts: 3
Joined: Mon 28 Aug 2006 19:13

Postby Alexey » Tue 29 Aug 2006 07:29

We cannot reproduce this problem with the latest version of PostgreSQLDirect. Please download it from our site and try.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for PostgreSQL