Microsoft.ApplicationBlocks.Data 中的问题
2005-01-07 17:35
477 查看
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();
}
}
查看其源代码:
//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();
}
}
相关文章推荐
- .NET组件(Microsoft.ApplicationBlocks.Data)
- Microsoft Application Verifier安装过程中(遇到注册表Image File Execution Options项无权限)的问题解决
- Microsoft Enterprise Library 5.0 系列(五) Data Access Application Block
- 黄聪:Microsoft Enterprise Library 5.0 系列教程(五) Data Access Application Block
- 问题-Error creating object. Please verify that the Microsoft Data Access Components 2.1(or later) have been properly installed.
- Microsoft Application Blocks for .NET
- 无法嵌入互操作类型“Microsoft.Office.Interop.Excel.ApplicationClass” 问题处理
- 黄聪:Microsoft Enterprise Library 5.0 系列教程(五) Data Access Application Block
- Microsoft Application Blocks for .NET
- Microsoft Application Blocks for .NET
- Initializing application data source问题的解决
- Microsoft Data Access Components 2.1 问题
- Microsoft Web Application Stress Tool无法使用问题
- Microsoft Enterprise Library 5.0 系列(五) Data Access Application Block
- Microsoft.Office.Interop.Excel.Application IIS权限问题
- vs2005中microsoft ado data control 6.0控件问题
- Microsoft Enterprise Library 5.0 系列(五) Data Access Application Block
- Asp.Net里面调用Microsoft Excel Application DCOM问题终极解决方法
- Microsoft Enterprise Library 5.0 系列(五) Data Access Application Block
- 解决ASP.NET1.1 access is denied: 'Microsoft.Data.Odbc' 的问题