IDbStoredProcedureManager.GetStoredProcedureCreateStatement Method
Returns the CREATE PROCEDURE template for creating a new stored procedure.
Namespace: Microsoft.Web.Management.DatabaseManager
Assembly: Microsoft.Web.Management.DatabaseManager (in Microsoft.Web.Management.DatabaseManager.dll)
Syntax
'Declaration
Function GetStoredProcedureCreateStatement ( _
connectionString As String _
) As Query
'Usage
Dim instance As IDbStoredProcedureManager
Dim connectionString As String
Dim returnValue As Query
returnValue = instance.GetStoredProcedureCreateStatement(connectionString)
Query GetStoredProcedureCreateStatement(
string connectionString
)
Query^ GetStoredProcedureCreateStatement(
String^ connectionString
)
function GetStoredProcedureCreateStatement(
connectionString : String
) : Query
Parameters
- connectionString
Type: System.String
The connection string for the database.
Return Value
Type: Microsoft.Web.Management.DatabaseManager.Query
A Query object that contains the CREATE PROCEDURE template for a new stored procedure.
Remarks
All database providers that implement the IDbStoredProcedureManager interface must also implement the GetStoredProcedureCreateStatement method, which returns a CREATE PROCEDURE statement for your database provider.
Notes for Implementers
If your provider does not support creating stored procedures, you can use the following code sample to raise a not-implemented exception:
public Query GetStoredProcedureCreateStatement(string connectionString)
{
throw new NotImplementedException();
}
Note
See the CREATE PROCEDURE (Transact-SQL) topic for more information about the CREATE PROCEDURE SQL statement.
Examples
The following code sample shows how to use the GetStoredProcedureCreateStatement method to return a stored procedure CREATE PROCEDURE SQL statement for your database provider.
Public Function GetStoredProcedureCreateStatement(ByVal connectionString As String) As Microsoft.Web.Management.DatabaseManager.Query Implements Microsoft.Web.Management.DatabaseManager.IDbStoredProcedureManager.GetStoredProcedureCreateStatement
Dim query As New Query()
query.Statement = "CREATE PROCEDURE ProcedureName " + vbCrLf + _
vbTab + "<@p1 int> = 0, " + vbCrLf + _
vbTab + "<@p2 int> = 0" + vbCrLf + _
"AS" + vbCr + vbLf + _
"BEGIN" + vbCrLf + _
vbTab + "SET NOCOUNT ON;" + vbCrLf + _
vbTab + "SELECT @p1, @p2" + vbCrLf + _
"END" + vbCrLf + _
"GO"
Return query
End Function
public Query GetStoredProcedureCreateStatement(string connectionString)
{
Query query = new Query();
query.Statement =
@"CREATE PROCEDURE ProcedureName
<@p1 int> = 0,
<@p2 int> = 0
AS
BEGIN
SET NOCOUNT ON;
SELECT @p1, @p2
END
GO";
return query;
}
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.