npgsql 0.7beta3 的一个Bug (submitted)

Posted on 2004-12-30 11:19  Aaron@cnblogs  阅读(1230)  评论(2编辑  收藏  举报
Summary: Parameters property of Command class doesnot support indexing by column name (ID: 1106)
Bug Type: Software bug
Severity: Serious
Software Version: 0.7beta3
Environment:
OS: windows 2003
DB:PostgreSQL 8.0.0-rc1
npgsql Package:Npgsql0.7beta3-bin
Description:
Parameters property of Command class doesnot support indexing by column name.
When I use these everything is okey:
IDbDataParameter idbPrmtr = cmd.Parameters[0] as IDbDataParameter;
...
But throw exception (System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.) when:
IDbDataParameter idbPrmtr = cmd.Parameters["ACertainColumnName"] as IDbDataParameter;

Exception detail:
---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

at System.Collections.ArrayList.get_Item(Int32 index)

at Npgsql.NpgsqlParameterCollection.System.Data.IDataParameterCollection.get_Item(String parameterName)

at KampSln.DataAccess.DataBaseInfo.PutDataToDb(Int32 toDbObjIndex, DataTable data, String toTableName) in c:\documents and settings\v-kaiboh\my documents\visual studio projects\itemmaintainment\dataaccess\databaseinfo.cs:line 551

--- End of inner exception stack trace ---

Another error:
IDbDataParameter idbPrmtr = cmd.Parameters[0] as IDbDataParameter;
is okey but
cmd.Parameters[0].Value = 1;
will throw an exception and say 'does not support index'.
¤Link:
 Bug report site