It turns out that the author has been using nbearlite in MSSQL, but recently I want to use it in MySQL and found a bug, mainly caused by the parameterization process. We all know that in the MSSQL database, all parameters are represented by @ ID, but are used in MySQL? Id representation (PostgreSQL and SQLite will also have the same problem). It turns out that nbearlite becomes? @ ID, so I modified the code.
The addexpressionparameters method of the sqlqueryfactory class is modified.
P. parametername = paramprefixtoken + en. Current. Key. trimstart (paramprefixtoken );
Changed:
If (paramprefixtoken! = '@')
{
P. parametername = en. Current. Key. Replace ("@", paramprefixtoken. tostring ());
}
Else
{
P. ParameterName = en. Current. Key;
}
That is, the problem is solved. This change also solves the problem of PostgreSql and Sqlite. This record is specially made to facilitate the use of Nbearlite to solve this problem smoothly.