Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database

How-To Create a CLR Function with EffiProz Database

0.00/5 (No votes)
17 Mar 2010CPOL 1  
EffiProz(www.e...
EffiProz(www.effiproz.com) C# database is a light weight embedded database for .NET, ASP.NET, .NET CF & Silverlight applications. This article demonstrates how to create CLR functions with effiproz database.

Any static function can be use as the body of the CRL function (containing assembly should be already loaded). The sample demonstrate how-to create a simple CLR function to add two numbers.

First create the static c# function, like this:
public static int Add(int x, int y) { return x + y; }


Then create a SQL function that reference the static function createtd above,
CREATE FUNCTION add_num(x INT, y INT)
RETURNS INT
NO SQL
LANGUAGE DOTNET 
EXTERNAL NAME 'EffiProz.CLFunctionSample.Add'


Now we can call add_num function as any regular SQL function. e.g:
SELECT add_num(3,4) FROM DUAL;


You can download the sample code with upcoming Effiproz Database 0.1RC from http://www.effiproz.com/samples/CLRFunctionSample.zip

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)