Microsoft.ApplicationBlocks.Data 中的问题

Microsoft.ApplicationBlocks.Data 中的SqlHelper类中有一个非常要命的问题。在使用SqlHelper.FillDataSet系列函数时,如果DataSet中包含的数据表多余2个,那只能给头两个数据表指定名称后面的就会变成Table3...n..
查看其源代码:

//Add the table mappings specified by the user
if (tableNames != null && tableNames.Length > 0)
{
 string tableName = "Table";
 for (int index=0; index < tableNames.Length; index++)
 {
  if( tableNames[index] == null || tableNames[index].Length == 0 ) throw new ArgumentException( "The tableNames parameter must contain a list of tables, a value was provided as null or empty string.", "tableNames" );
  dataAdapter.TableMappings.Add(tableName, tableNames[index]);
  tableName += (index + 1).ToString(); //问题就在这里,从第2个表开始tableName不是以“table2...tableN“的方式递增,而是以“table12,table123,table1...n“的方式递增。写成这样的方式就好了
tableName = "Table" + (index + 1).ToString();

 }
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值