In practice, we need to write a large number of programs, for example, to convert a table into a class object or write a method to call a stored procedure with N parameters, You need to manually enter a large amount of code, and there is a lot of repeated code. To avoid a lot of repetitive work and work convenience, I wrote such a simple code generator based on my own needs. Its functions are as follows:
Function 1:
Configure the database connection server (including the IP address, database, Logon account, and logon password of the database server), click OK to save the configuration, and the OK button is unavailable. A message dialog box is displayed.
Function 2;
Connect to the database. The corresponding user tables, stored procedures, and views are listed.
Function 3:
Generate code. In the Class Name text box, enter the name of the class to be generated, select the corresponding table, stored procedure, or view, and click Generate code. The generated code is saved in the root directory of drive C and displayed in the text box. For user tables or views, classes with attributes and constructor are generated. For stored procedures, classes with methods for calling stored procedures are generated.
How to use it. Configure the database before use.