Procedures
The Procedures schema collection describes the available stored procedures.
Retrieving the Stored Procedure Listing
To retrieve the Procedures schema collection, call the GetSchema method of the MYOBConnection class. Access the metadata in the DataTable object returned.
The following example outputs a list of stored procedure names:
C#
String connectionString = " If using an online instance: InitiateOAuth=GETANDREFRESH;OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CompanyFileId=yourCompanyFileId;CallbackURL=http://localhost:33333;User=companyFileUser;Password=companyFilePassword; If using an on premise instance: InitiateOAuth=OFF;URL=http://localhost:8080/accountright;CompanyFileId=327eed10-9615-4e5e-bd9e-ae2cc00e2c70;User=companyFileUser;Password=companyFilePassword;"; using (MYOBConnection conn = new MYOBConnection(connectionString)) { conn.Open(); DataTable table = conn.GetSchema("Procedures"); foreach (DataRow row in table.Rows) Console.WriteLine(row["SPECIFIC_NAME"]); }
VB.NET
Dim connectionString As String = " If using an online instance: InitiateOAuth=GETANDREFRESH;OAuthClientId=YourClientId;OAuthClientSecret=YourClientSecret;CompanyFileId=yourCompanyFileId;CallbackURL=http://localhost:33333;User=companyFileUser;Password=companyFilePassword; If using an on premise instance: InitiateOAuth=OFF;URL=http://localhost:8080/accountright;CompanyFileId=327eed10-9615-4e5e-bd9e-ae2cc00e2c70;User=companyFileUser;Password=companyFilePassword;" Using conn As New MYOBConnection(connectionString) conn.Open() Dim table As DataTable = conn.GetSchema("Procedures") For Each row As DataRow in table.Rows Console.WriteLine(row("SPECIFIC_NAME")) Next End Using
Columns Returned
The Procedures schema collection contains the following columns:
Column Name | Data Type | Description |
SPECIFIC_CATALOG | System.String | The name of the database containing the stored procedure. |
SPECIFIC_SCHEMA | System.String | The schema that contains the stored procedure. |
SPECIFIC_NAME | System.String | The name of the stored procedure containing the parameter. |
ROUTINE_CATALOG | System.String | The database containing the stored procedure. |
ROUTINE_SCHEMA | System.String | The schema containing the stored procedure. |
ROUTINE_NAME | System.String | The name of the stored procedure. |
ROUTINE_TYPE | System.String | Returns PROCEDURE for stored procedures and FUNCTION for functions. |