Product Documentation

c-treeACE V11.0 Update Guide

Previous Topic

Next Topic

Writing a New SP, UDF, or Trigger

To write a .NET stored procedure (SP), user-defined function (UDF), or trigger, follow these steps after creating your solution and/or projects from the previous topic:

  1. Right-click on your project (created in Preparing to Write a .NET SP, UDF, or Trigger) or in any folder under your project in Solution Explorer and choose Add/New Item.
  2. When the dialog appears, choose Visual C# Items > c-tree and choose the appropriate item.

    You may consider customizing the name of the .cs file that will be created. This name is not in any way associated with your stored procedure name.

  3. When done, click Add.

    Add New Item

  4. A new dialog appears. Fill in the fields:
    • Specify your stored procedure name.
    • Adjust the namespace if you require or prefer a customized project. This namespace does affect execution or definition of your stored procedure; however, your choice may help organize your work.
    • Set the procedure owner, parameters, and result set.

    Click OK.

A new source file is created. The class you implement is already prepared and you implement the ExecuteSP method with your application logic, as described later.

Previous Topic

Next Topic

Deploying the SP, UDF, or Trigger

Once coded, your SP, UDF, or trigger needs to be compiled and “deployed” to a server. Right-click it in Solution Explorer and choose Deploy to Server. One or more SP, UDF, or triggers can be deployed at the same time.

You are notified if any problems are encountered while the code is compiled and deployed to a c-treeACE SQL server.

Previous Topic

Next Topic

Testing the SP, UDF, or Trigger

A stored procedure can be run to test its behavior by right-clicking in Solution Explorer and choosing Test Procedure. A window appears allowing you to set the stored procedure’s parameters, execute it, and see the result generated.

Previous Topic

Next Topic

Debugging the SP, UDF, or Trigger

By right-clicking in Solution Explorer and choosing Debug Server it is possible to debug a SP, UDF, or trigger while the server runs it.

The server must be active and reachable while debugging. For simplicity, the server should be running on the same machine, although it is possible to debug a remote server using Microsoft remote debugger.

You can set a breakpoint in the code, launch a debug server (not necessarily in this sequence), and execute your stored procedure via external tools such as c-treeACE SQL Explorer, your own program, or Test Procedure as described above.

TOCIndex