This little utility generates a simple class, a series of properties corresponding to the field name, from the input of an SQL INSERT INTO statement.
I seem to end up doing this from time to time and this utility saves me much time when I need it.
You can download the installer for the program here, or a zipped version of the installer here, and you can download the source code here if you want it. The program currently only produces vb.net code but I may add a C# option later. The code is vb.net using Visual Basic 2010 so it is a VB 2010 project.
NO WARRANTY OF ANY kind IS GIVEN. THE PROGRAM IS SUPPLIED AS IS AND YOU USE IT AT YOUR OWN RISK.
The operation is very simple. Start the program, paste the INSERT statement, select the project visibility and if required the class name and hit convert. Click the clipboard copy button and paste into your project.
The screen looks like this:
Here is an INSERT statement that I will convert to a class:
Paste your statement into the top box. (Sorry you can’t scrape this one as it is an image due to WordPress web translation problems messing with the display even using pre)
If you don’t set a name for the class the program will use the name of the table, without the server name etc so in this instance it would give you a class name of:
Friend Class MED_tbl_CustomerConditions
You can set the visibility in the project from three choices: Public, Friend, Private.
Click “Convert to a class” when you are ready. In no time at all you get your class.
Currently the converter will handle these SQL types
- datetime or smalldatetime = Date
- float or real = Double
- money, smallmoney or numeric = Decimal
- varchar, nvarchar, char, nchar, text or ntext = String
- smallint = Short
- int = Integer
- tinyint = Byte
- bit = Boolean
If you can’t live with my variable naming download the code and fix it. Don’t complain to me!!
The program does NOT recognise any binary, GUID, image or other SQL variant/special types.
Here is the class listing produced above.