Skip site navigation (1) Skip section navigation (2)

BUG #6409: [NPGSQL]Fail to cast Int64 toSystem.Data.Common.DbParameter

From: aaron(dot)kb(dot)h(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6409: [NPGSQL]Fail to cast Int64 toSystem.Data.Common.DbParameter
Date: 2012-01-26 06:36:38
Message-ID: E1RqIwo-0007dl-Dq@wrigleys.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6409
Logged by:          AaronHuang
Email address:      aaron(dot)kb(dot)h(at)gmail(dot)com
PostgreSQL version: 9.1.2
Operating system:   Windows 7 Ultimate
Description:        

[Exception]
InvalidCastException:Unable to cast object of type 'System.Int64' to type
'System.Data.Common.DbParameter'.
[callstack]
   at
System.Data.Common.DbParameterCollection.System.Collections.IList.set_Item(Int32
index, Object value)
   at Kelly.TcsStatus.BackUp(DateTime fromTime, DateTime toTime, Int64[]
tcsIds, Int64[] statusIds, Int32[] versions) in XXXXX

[important]
I use IDbCommand than NpgsqlCommand. 

[code sample (not runable, only FYI)]
Int64 id = 100;
...
IDbCommand cmd = conn.CreateCommand();
NpgsqlParameter pkParameter = new NpgsqlParameter("id",
NpgsqlDbType.Bigint);
...
cmd.Parameters.Add(pkParameter);
...
cmd.Parameters[0] = id;// throw exception here.



pgsql-bugs by date

Next:From: harukatDate: 2012-01-26 08:08:28
Subject: BUG #6410: Windows say a unpleasant warning when stop a pgsql service
Previous:From: Eric BortsDate: 2012-01-26 00:36:01
Subject: Windows x86-64 One-Click Install (9.1.2-1, 9.0.6-1) hangs on "initialising the database cluster" (with work-around)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group