PostgresException:'42601:syntax error at or near“$1”位置:25
public async Task Delete(string dbName) {
using(var connection = GetNewConnection()) {
connection.Open();
using(var command = new NpgsqlCommand("DROP DATABASE IF EXISTS @dbName;", connection)) {
command.Parameters.AddWithValue("@dbName", dbName);
command.ExecuteNonQuery();
}
}
await Task.CompletedTask;
}
字符串
1条答案
按热度按时间vsmadaxz1#
与注解中一样,
DROP DATABASE
等SQL语句不能与参数一起使用。