我有以下代码:
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+" " +
有用。是什么赋予了?
提前致谢