Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TranslateParameters Bug?
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
TranslateParameters Bug?
Divers
Thread ID:
00786305
Message ID:
00786305
Vues:
65
I think I might have discovered a bug while trying to figure out if I could used the question mark ("?") placeholder in SQL parameters using MM and SqlClient data provider.

The "the mmDataAccessSql.TranslateParameters" method loops through Parameter collection in a command object, with intent to replace the "?" placeholder with the names of each sequential parameter (i.e. "@param1"). But the "Replace" method is used, which appears to replace ALL occurrences of the "?" placeholder, so when the second parameter is reached in the loop, all the placeholders have been replaced with the name of the first parameter. The code that looks suspect is the following line:

if (Position >= 0)
{
cmdText = cmdText.Replace("?", param.ParameterName);
}

It seems as though only the FIRST occurrence should be replace, while this replaces ALL the occurrences of "?".
Brian Burlingame
Software Engineer/Consultant
Olympic Consulting Group
brian.burlingame@ocgworld.com
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform