C# T-SQL Stored Procedure Wrapper with dbscript

As my article on generating a C# wrapper for T-SQL Stored Procedures has recently become one of the most popular posts, I thought of providing an implementation within dbscript.

From the various different possibilities (generate from a Project Versions’ schema information, define an XSL on the Project Version’s XML) I chose the simplest solution was to create two Code Snippets.

The Code Snippet “Stored Procedure Wrapper (2000)” queries sysobjects, syscolumns and systypes, as outlined in the post.

The second Code Snippet, “Stored Procedure Wrapper”, queries the INFORMATION_SCHEMA views ROUTINES and PARAMETERS to achieve the same goal.

The generated C# code can be copied directly from the browser window into Visual Studio.

The Code Snippets can be downloaded here along with version 0.95 of dbscript, and will be included in future versions.

Leave a Reply