Objective:
This example is very simple, and the main purpose of this example is to familiarize you with the creation of a SQL-complex CRL function.
In the Web page to pass variables, usually first encoded, and then decoded. In. NET implementation of this feature, very simple direct call (Microsoft has been processing completed),
It's encoded:
String Message = Server.UrlEncode("欢迎学习ASP.NET!");
Response.Redirect("WebForm2.aspx?Msg=" + Message);
It's decoding:
Label1.Text=Server.UrlDecode(Request.QueryString["Msg"]);
If you implement this method in SQL 2000, it is not easy to find the UrlEncode and UrlDecode principles, and then parse the encoding and decoding strings. (If you are interested, you can try to write down, the Internet to see the implementation of SQL 2000, there are problems.) )
SQL 2005 Implementation process:
If we use SQL 2005 to achieve such functionality, that is very convenient. The steps are described below. (as the screenshot is more intuitive, I take screenshots mainly)
One: Create a SQL Server 2005 database project, as shown in the following figure:
Two: Configure the database you want to add the CLR function to. The following figure: