Method RunSql
- Namespace
- YndigoBlue.Velocity.Engine
- Assembly
- YndigoBlue.Velocity.dll
RunSql(string)
Executes a raw SQL command against the database.
public void RunSql(string sql)
Parameters
sqlstringThe SQL statement to execute.
Examples
using (var m = new Manager(conn))
{
// Execute a database-specific command
m.RunSql("ANALYZE TABLE users");
// Or execute a custom stored procedure
m.RunSql("CALL update_statistics()");
}
Remarks
Use this method to execute SQL that is not supported through other Velocity methods. Be cautious with raw SQL as it bypasses Velocity's abstraction and may not be portable across database systems.
Exceptions
- DbException
Thrown when a database error occurs.