SurrealDB Docs Logo

Enter a search query

.Query()

Runs a set of SurrealQL statements against the database.

Method Syntax
await db.Query(sql)

Arguments

ArgumentsDescription
sql required

Specifies the SurrealQL statements.

cancellationToken optional

The cancellationToken enables graceful cancellation of asynchronous operations.

Example usage

// Execute query with params const string table = "person"; var result = await db.Query($"CREATE person; SELECT * FROM type::table({table});"); // Get the first result from the first query var created = result.GetValue<Person>(0); // Get all of the results from the second query var people = result.GetValue<List<Person>>(1);

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install