From: aaron.kb.h@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6409: [NPGSQL]Fail to cast Int64 to System.Data.Common.DbParameter
Date: Thu, 26 Jan 2012 06:36:38 +0000
Message-ID: <E1RqIwo-0007dl-Dq@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 6409
Logged by: AaronHuang
Email address: aaron.kb.h@gmail.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: aaron.kb.h@gmail.com
Subject: Re: BUG #6409: [NPGSQL]Fail to cast Int64 to System.Data.Common.DbParameter
In-Reply-To: <E1RqIwo-0007dl-Dq@wrigleys.postgresql.org>
References: <E1RqIwo-0007dl-Dq@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox