Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TranslateParameters Bug?
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
TranslateParameters Bug?
Miscellaneous
Thread ID:
00786305
Message ID:
00786305
Views:
66
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
Next
Reply
Map
View

Click here to load this message in the networking platform