SQLite Forum

User Defined Functions
Login
<i>Thanks Keith; as I've mentioned, lack of C/C++ experience is holding me back and I'd appreciate some help.</i>


I am looking for a way to achieve [what follows below](https://docs.microsoft.com/en-us/dotnet/standard/data/sqlite/user-defined-functions) <b>using the API</b> sqlite3_create_function: is that possible? 

```
connection.CreateFunction(
    "volume",
    (double radius, double height)
        => Math.PI * Math.Pow(radius, 2) * height);

var command = connection.CreateCommand();
command.CommandText =
@"
    SELECT name,
           volume(radius, height) AS volume
    FROM cylinder
    ORDER BY volume DESC
";
```