Click here to Skip to main content
15,885,537 members
Articles / Programming Languages / Visual Basic
Article

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

Rate me:
Please Sign up or sign in to vote.
1.35/5 (17 votes)
7 Mar 20052 min read 74.2K   2.2K   34   10
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

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
I am a Senior Software developer who does a consulting work for several companies. Mostly it's an E-Commerce project.

I do have my own venture. Small online store my wife runs. Body Jewelry. Also visit Piercing info Cool thing is that nor I nor my wife has any piercings. My new website is Belly ring

Comments and Discussions

 
QuestionWhy should we use Code Generators? Pin
Iqbal M Khan15-Feb-07 1:43
Iqbal M Khan15-Feb-07 1:43 
Generalhi Pin
man_chat_8322-Dec-06 2:59
man_chat_8322-Dec-06 2:59 
Generala better option Pin
krausscarlos28-Jul-06 6:47
krausscarlos28-Jul-06 6:47 
Generalms access query and C# Pin
shaw_luo27-Sep-04 21:27
shaw_luo27-Sep-04 21:27 
GeneralDALMaker.NET Pin
TLWallace29-Dec-03 14:17
TLWallace29-Dec-03 14:17 
QuestionVB? Pin
Daniel Fisher (lennybacon)22-Dec-03 8:36
Daniel Fisher (lennybacon)22-Dec-03 8:36 
AnswerRe: VB? Pin
Gevorg22-Dec-03 12:57
Gevorg22-Dec-03 12:57 
GeneralRe: VB? Pin
ralphw23-Dec-03 3:14
ralphw23-Dec-03 3:14 
GeneralRe: VB? Pin
Gevorg23-Dec-03 15:01
Gevorg23-Dec-03 15:01 
GeneralRe: VB? Pin
Daniel Fisher (lennybacon)23-Dec-03 9:20
Daniel Fisher (lennybacon)23-Dec-03 9:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.