Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics

How to execute stored procedures from events

Scroll Prev Next More

Executing an SQL Server stored procedure from events

Calling the procedure without parameters.

 

If stored procedure doesn't return the recordset:

 

 

DB.Exec("EXEC StoredProcNameHere");

 

 

 

 

If stored procedure returns the recordset:

 

 

DB.Query("EXEC StoredProcNameHere");

 

 

 

Passing one of the field values as a parameter:

 

string sql = DB.PrepareSQL("EXEC StoredProcNameHere ':1'", values["FieldName"].ToString());
DB.Exec(sql);

Executing MySQL stored procedure from the event

Calling the procedure without parameters.

 

If stored procedure doesn't return the recordset:

 

 

 

DB.Exec("CALL StoredProcNameHere");

 

 

 

If stored procedure returns the recordset:

 

 

 

DB.Query("CALL StoredProcNameHere");

 

 

 

 

Passing one of the field values as a parameter:

 

string sql = DB.PrepareSQL("CALL StoredProcNameHere ':1'", values["FieldName"].ToString());
DB.Exec(sql);

 

Executing ORACLE stored procedure from the event

Calling the procedure without parameters.

 

If stored procedure doesn't return the recordset:

 

 

DB.Exec("BEGIN STOREDPROCNAME(); END;");

 

 

 

 

If stored procedure returns the recordset:

 

 

DB.Query("BEGIN STOREDPROCNAME(); END;");

 

 

 

Passing one of the field values as a parameter:

 
string sql = DB.PepareSQL("BEGIN STOREDPROCNAME(':1'); END;", values["FieldName"]);
DB.Query(sql);

 

See also:

Connecting to the database

Connecting to Oracle database

Table events

Global events