473,498 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WARNING: Error in the Data Access Application Block (C# only)

I found an error in the Data Access application, specifically in the
tableMappings in the FillDataSet() overload with the following signature:

private static void FillDataset(SqlConnection connection, SqlTransaction
transaction,
CommandType commandType, string commandText, DataSet dataSet,
string[] tableNames, params SqlParameter[] commandParameters)
{
}

The code in question is line 1840 (C#), which reads:

tableName += (index + 1).ToString();

Assuming the following string:

string tableNames = {"MyTable1", "MyTable2", "MyTable3", "MyTable4" };

this original statement will produce:

dataAdapter.TableMappings.Add("Table" , "MyTable1");
dataAdapter.TableMappings.Add("Table1" , "MyTable2");
dataAdapter.TableMappings.Add("Table12" , "MyTable3");
dataAdapter.TableMappings.Add("Table123" , "MyTable4");

This is incorrect. It should be:

dataAdapter.TableMappings.Add("Table" , "MyTable1");
dataAdapter.TableMappings.Add("Table1" , "MyTable2");
dataAdapter.TableMappings.Add("Table2" , "MyTable3");
dataAdapter.TableMappings.Add("Table3" , "MyTable4");

FIX: The corrected version of this line (for reference: line 1840):

tableName = tableName + (index + 1).ToString();

NOTE that the VB.NET version is correct, with this string:
tableName = tableName & (index + 1).ToString()


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
Nov 15 '05 #1
1 1383
FIX (incorrect):
tableName = tableName + (index + 1).ToString();

FIX (correct):
tableName = "Table" + (index + 1).ToString();

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote in
message news:%2****************@TK2MSFTNGP09.phx.gbl...
I found an error in the Data Access application, specifically in the
tableMappings in the FillDataSet() overload with the following signature:

private static void FillDataset(SqlConnection connection, SqlTransaction
transaction,
CommandType commandType, string commandText, DataSet dataSet,
string[] tableNames, params SqlParameter[] commandParameters)
{
}

The code in question is line 1840 (C#), which reads:

tableName += (index + 1).ToString();

Assuming the following string:

string tableNames = {"MyTable1", "MyTable2", "MyTable3", "MyTable4" };

this original statement will produce:

dataAdapter.TableMappings.Add("Table" , "MyTable1");
dataAdapter.TableMappings.Add("Table1" , "MyTable2");
dataAdapter.TableMappings.Add("Table12" , "MyTable3");
dataAdapter.TableMappings.Add("Table123" , "MyTable4");

This is incorrect. It should be:

dataAdapter.TableMappings.Add("Table" , "MyTable1");
dataAdapter.TableMappings.Add("Table1" , "MyTable2");
dataAdapter.TableMappings.Add("Table2" , "MyTable3");
dataAdapter.TableMappings.Add("Table3" , "MyTable4");

FIX: The corrected version of this line (for reference: line 1840):

tableName = tableName + (index + 1).ToString();

NOTE that the VB.NET version is correct, with this string:
tableName = tableName & (index + 1).ToString()


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
404
by: José Joye | last post by:
Hi, Does anyone know if there is a planned support for MS Access in the MS DAAB? Thanks, José
0
981
by: José Joye | last post by:
Does anyone know if there is a planned support for MS Access in the MS Data Access Application Block? This application block is now part of the MS enterprise library. I know I could do it...
4
1893
by: ad | last post by:
I want to develop DataBase application. How about Data Access Application Block? Is it useful?
0
2207
by: ad | last post by:
I have used Data Application Access Block2 in my web application. Now I download the Library Data Access Application Block. and read the document. May be I am stupid, I can't migrate it to...
1
1911
by: EO | last post by:
I am trying to use the MSFT data access application block on 3 machines. Machine 1: Sandbox environment; I installed the application block with the msi. The Sqlhelper class compiles & runs...
3
1877
by: Rachel | last post by:
Hi, I am using the data access application block successfully in our development environment, however when I deploy to our testing server as Private Assemblies I keep getting the following ...
3
1703
by: Rachel | last post by:
Hi, I am using the data access application block successfully in our development environment, however when I deploy to our testing server as Private Assemblies I keep getting the following ...
2
1100
by: Alphonse Giambrone | last post by:
I just downloaded the new MS Paterns & Practices Enterprise Library to use the Data Access Application Block in a web app. Am I missing something, or can the connection string only be set in the...
2
2492
by: Tim::.. | last post by:
Can someone tell me how you change this code for an Oledb connection rather than SQL Server. The code currently uses Microsoft.Data.Access.Application.Block and the SQLHelper object... I need to...
3
2899
by: SAL | last post by:
Hi, I have Microsoft Enterprise Library 2005 installed on my local system. I'm developing in C# using Visual Studio 2003 IDE with framework 1.1. I am automating a process that will use a DLL...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7208
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1423
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.