473,626 Members | 3,320 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(Sql Connection connection, SqlTransaction
transaction,
CommandType commandType, string commandText, DataSet dataSet,
string[] tableNames, params SqlParameter[] commandParamete rs)
{
}

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.Tab leMappings.Add( "Table" , "MyTable1") ;
dataAdapter.Tab leMappings.Add( "Table1" , "MyTable2") ;
dataAdapter.Tab leMappings.Add( "Table12" , "MyTable3") ;
dataAdapter.Tab leMappings.Add( "Table123" , "MyTable4") ;

This is incorrect. It should be:

dataAdapter.Tab leMappings.Add( "Table" , "MyTable1") ;
dataAdapter.Tab leMappings.Add( "Table1" , "MyTable2") ;
dataAdapter.Tab leMappings.Add( "Table2" , "MyTable3") ;
dataAdapter.Tab leMappings.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 1389
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.netNoS pamM> wrote in
message news:%2******** ********@TK2MSF TNGP09.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(Sql Connection connection, SqlTransaction
transaction,
CommandType commandType, string commandText, DataSet dataSet,
string[] tableNames, params SqlParameter[] commandParamete rs)
{
}

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.Tab leMappings.Add( "Table" , "MyTable1") ;
dataAdapter.Tab leMappings.Add( "Table1" , "MyTable2") ;
dataAdapter.Tab leMappings.Add( "Table12" , "MyTable3") ;
dataAdapter.Tab leMappings.Add( "Table123" , "MyTable4") ;

This is incorrect. It should be:

dataAdapter.Tab leMappings.Add( "Table" , "MyTable1") ;
dataAdapter.Tab leMappings.Add( "Table1" , "MyTable2") ;
dataAdapter.Tab leMappings.Add( "Table2" , "MyTable3") ;
dataAdapter.Tab leMappings.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
991
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 myself... However, my question is: Does MS or someone else did it or plan to do it. Thanks, José
4
1905
by: ad | last post by:
I want to develop DataBase application. How about Data Access Application Block? Is it useful?
0
2220
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 Enterprise Library Data Access Application Block. The code below is the Data Application Access Block 2, How can I modified them? //---------------using Data Application Access Block
1
1922
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 great! (Also the SqlhelperParameterCache class; I'll refer to them collectively as the SqlHelper class.) I'm using unmodified application block code in all cases. Machine 2: Development environment, different project
3
1890
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 Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
3
1720
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 Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
2
1109
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 dataconfiguration.config file?? For one thing I would like to encrypt the string as MS has always recommended. How can that be done? But also I need to connect to two different databases. How to do this? TIA
2
2499
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 use this with an access database! reader = SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("strConn"), CommandType.StoredProcedure, "rolesForUser", New OleDbParameter("@Username", User.Identity.Name))
3
2903
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 assembly I am developing. I am going to use the data Access Application Block for data access in my DLL assembly, and a Windows Service will execute the DLL on a set schedule. To make this happen I will add the Common, Configuration, and Data...
0
8199
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8638
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
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 we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.