-1
データベースから多数の行を返すメソッドがあります。私はこの方法を実行するとArrayListの容量は32768を超えていません
public static ACollection GetListFromDatabase(string customername)
{
DBFactory factory = DBFactory.Instance;
ACollection custcol = new ACollection();
//This is a collection class extended from System.Collections.CollectionBase
System.Data.IDataReader reader = null;
try
{
reader = factory.GPDb.ExecuteReader("spGetCustomerInfo", customernumber);
while (reader.Read())
{
ACollection cust = ACollection.ListFromReader(reader); // returns info and assign it to ACollection object.
custcol.InnerList.Add(cust);
}
}
catch (Exception e)
{
String error = e.Message;
}
finally
{
if (reader != null)
reader.Close();
}
return custcol;
}
を(以下を参照してください)、私はその後、私はそれが例外になることを見た、それは周りに34000のはずどこcustcol.InnerListのカウントが32767であることに気づきました。
エラーメッセージに「値が大きすぎるか小さすぎてInt16にはありませんでした」と表示されます。
私は、このarraylistの能力は何とかint16として割り当てられると思います。誰かが容量を増やすのを助けることができますか?
おかげ
編集:ここ がフルスタックトレース
at System.Convert.ToInt16(Int64 value)
at System.Int64.System.IConvertible.ToInt16(IFormatProvider provider)
at System.Convert.ToInt16(Object value)
at Quest___Shared.CustomerCrossReference.ListFromReader(IDataReader reader) in C:\vsproject\CustomerCrossReference.cs:line 105
at Quest___Shared.ACollection.GetListFromDatabase(String customernumber) in C:\vsproject\ACollection.cs:line 88
DataTableは16,777,216行を保持することができます – Plutonix
'ArrayList'に問題はありますか?あなたの 'ACollection.ListFromReader'の実装は、' cust'の16ビットプロパティに大きな32ビットまたは64ビットのカラム値を割り当てようとしますか?あるいは、負の列の値を 'ushort'プロパティに代入しているのでしょうか?例外のスタックトレース全体を見ることができれば、これを判断するのに役立ちます。 – wablab
私はあなたの分析を疑う。しかし、ArrayListはあまり推奨されていません。代わりにリストを使用してください! –
TaW