I am currently using string replace in some parts of the code type= type.Replace("TRIM", "RTRIM");
type = type.Replace("TRIM", "RTRIM");
StringBuilder builder =newStringBuilder();
builder.AppendLine(" .....bla bla...");
if (type.Trim() != ""){
builder.AppendLine(@" WHERE ({0}) ");
}
The database current {0} values are
- TRIM(VL9) LIKE '{1}%'
- TRIM(VL7) LIKE '{0}%' 3.(TRIM(VL9) LIKE '{0}%'))
- (VL9 LIKE '{1}%' AND (TRIM(VL9) LIKE '{0}%') )
This is a huge database, and the replace function is used in many files at many places. In future they will change TRIM
's to RTRIM
's in the database so then in the code(.cs files) replace string becomes
RRTRIM
which gives us an error.
Is there any simple way to code which works now and after future changes?
PS: originally the .cs queries were in DB2 which are now changed to SQL SERVER queries and now they will be making changes in db like changing TRIM
to RTRIM
)