I made a service and it retrieve sql command from physical xml file.
It looks like:
<Sql>
<![CDATA[
SELECT
MAX(COMM_HIST_NO) AS COMM_HIST_NO
, MAX(COMMUTER_NO) AS COMMUTER_NO
, MAX(ARRIVED_AT_WORK) AS ARRIVED_AT_WORK
, MAX(LEFT_WORK) AS LEFT_WORK
FROM COMMUTE_HISTORY
WHERE COMMUTER_NO = {0}
AND DATEDIFF(DAY, {1}, GETDATE()) = 0
]]>
</Sql>
And here's what returns sql command as a string:
// arParams is an Array.
string.Format(xmlDoc.SelectSingleNode("/SVC/Sql").InnerText,arParms)
{1} is going to be a column name and I want my {1} parameter to be written as column name, which has no single quotes.
To be specific, Mybatis in Java provides ${param}
and #{param}
and the latter one gets rid of single quotes from the string param.
.NET must have developed this feature!