在下面的代码中,用于获取特定行中的产品列表,该命令仅在我硬编码(连接)productLine到SQL 时返回结果.参数替换永远不会发生.
+ "lineName = '@productLine' "
+ "and isVisible = 1 ";
MySqlDataAdapter adap = new MySqlDataAdapter(sql, msc);
adap.SelectCommand.Parameters.Add("@productLine", productLine);
Run Code Online (Sandbox Code Playgroud)
+ "lineName = ?productLine "
+ "and isVisible = 1 ";
MySqlDataAdapter adap = new MySqlDataAdapter(sql, msc);
adap.SelectCommand.Parameters.Add("?productLine", productLine);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2958 次 |
| 最近记录: |