winzip icon


Submitted on: 1/1/2015 7:26:00 AM
By: Hilton Giesenow (from psc cd)  
Level: Intermediate
User Rating: By 5 Users
Compatibility: C#, VB.NET, ASP.NET, C++.NET
Views: 5238
     VB.NET Class Generator From Databases - In order to simplify the interaction with a database and decrease development time, many systems contain classes that represent database objects. For example, one could create a "Customer" class with "Name" and "Email" properties and "Update" and "Delete" methods. These actions and properties would be interacting with the database in the background, thus abstracting the user from the lower-level DB details. I have written a web service that receives an XML dataset as a parameter, and returns a string array representing the automatically generated classes and collections to achieve what is described above. This web service can be called from any application in virtually any language. The code provided here is one implementation written in VB.NET that takes a SQL Server connection string, builds the database structure in a dataset, and writes out the files to a supplied path. Restrictions: The current restrictions for this app are that the table can have only 1 primary key field, and this key field must be numeric. Also, the app automatically attempts to connect to certain stored procedures. The names of these stored procedures are taken from the table name. These names are (for e.g. with a table called tblCustomer) To view all records : spCustomersView To view 1 record : spCustomerView To add a record : spCustomerAdd To edit a record : spCustomerEdit To delete a record : spCustomerDelete To change the names of these Stored Procs, just locate them in the .vb text and change them. to not use Stored procs, change the s.p. name to SQL text, and change the StoredProcedure value of the database command / DataAdapter to CommandText. Also, a note on names. The app requires each table to have an initial capital letter. This is because I use naming conventions for my tables. Normal tables have a prefix of "tbl". Linking tables are prefixed "tlnk", and lookup tables (for genders, for example) are prefixed "tlk". For example, a customer table would be called tblCustomer. However, Customer would work ok too. This app forms part of an Honours course. As such, I would greatly appreciate feedback. You can contact me at Let me know any suggestions / comments, or at least briefly what you are using the app for. The service itself is at Thanks, Hilton
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.