Click here to Skip to main content
Click here to Skip to main content
Articles » Database » Database » Utilities » Downloads
 
Add your own
alternative version
Go to top

SQL Stored Procedure Wrapper & Typed DataSet Generator for .NET

, 7 Dec 2002
This a small tool that will generate static methods in a class that acts as wrapper for SQL stored procedures. It either outputs a source file or a compiled assembly. Also supports automatic DataSet generation.
dbhelper-1.0.zip
DBHelper
CVS
Base
Baserev
Entries
Repository
Root
DBHelper.suo
DBHelper.vssscc
SP
CVS
Base
Baserev
Entries
Repository
Root
DBHelper.csproj.user
DBHelper.csproj.vspscc
SPTestApp
App.ico
CVS
Base
Baserev
Entries
Repository
Root
SPTestApp.csproj.user
SPTestApp.csproj.vspscc
dbhelper-1.1.zip
Baserev
Entries
Repository
Root
DBHelper.suo
DBHelper.vssscc
Baserev
Entries
Repository
Root
DBHelper.csproj.user
DBHelper.csproj.vspscc
App.ico
Baserev
Entries
Repository
Root
SPTestApp.csproj.user
SPTestApp.csproj.vspscc
dbhelper-1.2.zip
Baserev
Entries
Repository
Root
DBHelper.suo
DBHelper.vssscc
Baserev
Entries
Repository
Root
DBHelper.csproj.user
DBHelper.csproj.vspscc
App.ico
Baserev
Entries
Repository
Root
SPTestApp.csproj.user
SPTestApp.csproj.vspscc
dbhelper-1.3.zip
Baserev
Entries
Repository
Root
DBHelper.suo
DBHelper.vssscc
Baserev
Entries
Repository
Root
DBHelper.csproj.user
DBHelper.csproj.vspscc
App.ico
Baserev
Entries
Repository
Root
SPTestApp.csproj.user
SPTestApp.csproj.vspscc
dbhelper-1.4.zip
Baserev
Entries
Repository
Root
dbh.gif
DBHelper.suo
DBHelper.vssscc
Baserev
Entries
Repository
Root
DBHelper.csproj.user
DBHelper.csproj.vspscc
App.ico
Baserev
Entries
Repository
Root
SPTestApp.csproj.user
SPTestApp.csproj.vspscc
dbhelper-1.5.demo.zip
SPTestApp.exe
DBHelper.dll
Interop.MSDASC.dll
dbhelper-1.5.src.zip
Baserev
Entries
Repository
Root
dbh.gif
DBHelper.suo
DBHelper.vssscc
Baserev
Entries
Repository
Root
DBHelper.csproj.user
DBHelper.csproj.vspscc
App.ico
Baserev
Entries
Repository
Root
SPTestApp.csproj.user
SPTestApp.csproj.vspscc
dbhelper-1.6.demo.zip
SPTestApp.exe
DBHelper.dll
Interop.MSDASC.dll
dbhelper-1.6.src.zip
Baserev
Entries
Repository
Root
dbh.gif
DBHelper.suo
DBHelper.vssscc
Baserev
Diff
Entries
Repository
Root
DBHelper.csproj.user
DBHelper.csproj.vspscc
App.ico
Baserev
Entries
Repository
Root
SPTestApp.csproj.user
SPTestApp.csproj.vspscc
dbhelper-16demo.zip
SPTestApp.exe
DBHelper.dll
Interop.MSDASC.dll
dbhelper-16src.zip
Baserev
Entries
Repository
Root
dbh.gif
Baserev
Entries
Repository
Root
DBHelper.csproj.user
App.ico
Baserev
Entries
Repository
Root
SPTestApp.csproj.user
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace SPTestApp
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
      private System.Windows.Forms.CheckedListBox checkedListBox1;
      private System.Windows.Forms.TextBox textBox1;
      private System.Windows.Forms.Button button1;
      private System.Windows.Forms.Button button2;
      private System.Data.SqlClient.SqlConnection sqlConnection1;

      DBHelper.SP sp;
      private System.Windows.Forms.TextBox textBox2;
      private System.Windows.Forms.TextBox textBox3;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

         sp = new DBHelper.SP(sqlConnection1);

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
         this.checkedListBox1 = new System.Windows.Forms.CheckedListBox();
         this.textBox1 = new System.Windows.Forms.TextBox();
         this.button1 = new System.Windows.Forms.Button();
         this.button2 = new System.Windows.Forms.Button();
         this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
         this.textBox2 = new System.Windows.Forms.TextBox();
         this.textBox3 = new System.Windows.Forms.TextBox();
         this.SuspendLayout();
         // 
         // checkedListBox1
         // 
         this.checkedListBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
         this.checkedListBox1.CheckOnClick = true;
         this.checkedListBox1.Name = "checkedListBox1";
         this.checkedListBox1.Size = new System.Drawing.Size(584, 272);
         this.checkedListBox1.TabIndex = 0;
         // 
         // textBox1
         // 
         this.textBox1.Location = new System.Drawing.Point(8, 288);
         this.textBox1.Name = "textBox1";
         this.textBox1.Size = new System.Drawing.Size(88, 20);
         this.textBox1.TabIndex = 1;
         this.textBox1.Text = "Filename.cs";
         // 
         // button1
         // 
         this.button1.Location = new System.Drawing.Point(504, 288);
         this.button1.Name = "button1";
         this.button1.TabIndex = 2;
         this.button1.Text = "Generate";
         this.button1.Click += new System.EventHandler(this.button1_Click);
         // 
         // button2
         // 
         this.button2.Location = new System.Drawing.Point(424, 288);
         this.button2.Name = "button2";
         this.button2.TabIndex = 3;
         this.button2.Text = "Get SP";
         this.button2.Click += new System.EventHandler(this.button2_Click);
         // 
         // sqlConnection1
         // 
         this.sqlConnection1.ConnectionString = "";
         // 
         // textBox2
         // 
         this.textBox2.Location = new System.Drawing.Point(104, 288);
         this.textBox2.Name = "textBox2";
         this.textBox2.Size = new System.Drawing.Size(88, 20);
         this.textBox2.TabIndex = 4;
         this.textBox2.Text = "NameSpace";
         // 
         // textBox3
         // 
         this.textBox3.Location = new System.Drawing.Point(200, 288);
         this.textBox3.Name = "textBox3";
         this.textBox3.Size = new System.Drawing.Size(88, 20);
         this.textBox3.TabIndex = 5;
         this.textBox3.Text = "ClassName";
         // 
         // Form1
         // 
         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(584, 317);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                      this.textBox3,
                                                                      this.textBox2,
                                                                      this.button2,
                                                                      this.button1,
                                                                      this.textBox1,
                                                                      this.checkedListBox1});
         this.Name = "Form1";
         this.Text = "Form1";
         this.ResumeLayout(false);

      }
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

      private void button2_Click(object sender, System.EventArgs e)
      {
         checkedListBox1.DataSource = sp.Names;
      }

      private void button1_Click(object sender, System.EventArgs e)
      {
         string[] sps = new string[checkedListBox1.CheckedItems.Count];
         for (int i = 0; i < sps.Length; i++) 
            sps[i] = checkedListBox1.CheckedItems[i].ToString();
         sp.CreateFile(sps, textBox2.Text, textBox3.Text, textBox1.Text);
         System.CodeDom.Compiler.CompilerResults results = 
            sp.Compile(sps, textBox2.Text, textBox3.Text, textBox1.Text.Replace("cs", "dll"));
         string msg = "";
         if (results.Errors.Count == 0)MessageBox.Show(this, "Done");
         else 
         {
            foreach (System.CodeDom.Compiler.CompilerError err in results.Errors)
            {
               msg += err.ToString() + "\n";
            }
            MessageBox.Show(this, msg);
         }
      }
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License

Share

About the Author

leppie
Software Developer
South Africa South Africa
No Biography provided
Follow on   Twitter

| Advertise | Privacy | Mobile
Web02 | 2.8.140905.1 | Last Updated 8 Dec 2002
Article Copyright 2002 by leppie
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid