我有以下代码:
string connectionString =
"Provider=Microsoft.JET.OLEDB.4.0;" +
"data source=" + processProgramPath + ";";
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
connection.Open();
using (OleDbCommand command = new OleDbCommand(
"SELECT @Value " +
"FROM BONDPARAMETERS " +
"WHERE BONDPARAMETERS.SetName = @SetName", connection))
{
command.Parameters.AddWithValue("@Value", value);
command.Parameters.AddWithValue("@SetName", setName);
var result = command.ExecuteScalar();
return result.ToString();
}
}
我期望获得的是760。但是我得到了StartForce专栏的标题。
value =“StartForce” setName =“450(18)-F-OE”
如果我将使用更改为:
using (OleDbCommand command = new OleDbCommand("SELECT "+value+" " +
它有效。是什么给了什么?
提前致谢