65.9K
CodeProject is changing. Read more.
Home

Simple C# codegenerator for DB objects (table, store procedure)

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.35/5 (14 votes)

Dec 17, 2003

2 min read

viewsIcon

74804

downloadIcon

2189

This small utility generates code to call store procedure or C# class from Table

Sample Image - gener.jpg

Introduction

This is a simple utility i wrote after working on a big project.

After i had to manually create code to call store procedures and every time i had to switch back and forth between Edit screen and database screen to find out necessary parameters, their types, and length i started to look for the wizard which will do it automatically.

After goggling for about 30 minutes i could not find anything but one tool for which author was asking $60 and trial version i downloaded did not work correctly (or in some cases would give GPF ) i decided to spend couple hours.

Since i am a C# programmer the code is generated is C# code. Also if you are using different naming convention than i am you may have to modify the source.

For some, totally unknown for me, reason i wrote the tool in VB 6 not in C#. Do not know why. But i did it :).

Anyway download demo project and give it a try.

 

Documentation

1. First you will have to provide connection string to your SQL server. Copy and paste it from existing project.
IMPORTANT: Connection string must be in ADO format. Not ADO.NET. Example: Provider=SQLOLEDB.1;Password=pwd;Persist Security Info=True;User ID=sa;Initial Catalog=Database;Data Source=GTL

Do not be afraid program will remember it. So next time you bring it up it will have that string.

2. Choose an action and click generate. Or you can "Generate All" to generate code for all possible actions.

3. The program is totally unintelligent ( i spent only couple hours to work on it) and you will have to modify the code it generates (especially for and Update store procedure WHERE clause). But it serves it's purpose most tedious work is taken care of.

 

 

 

 

Thanks and enjoy.

Feel free to modify source code.

Email: gevorgspam@comcast.net  (remove 'spam' from my email)

Gevorg Ter-Saakov.

Body Jewelry. Labrets, Barbells, Nose screws, Piercing supply