how to add new fields to a table at the time of execution of a vb.net system? [closed]

-1

Thank you in advance for reading my question.

I am developing a system on VB.net and Sql Server, they ask me to add a part where the system finished they can add a new field or delete an existing one from some table but from the system (So there is a section for create or delete a new field).

I have no idea how it is done or how difficult it is, hopefully and you can guide me or give an example of how it is done, or if it is very difficult to tell me too.

Thank you very much ...

    
asked by Cristian 27.03.2018 в 16:47
source

1 answer

0

Adding new columns to a table from an application is not recommended, since as your application grows (Scalability Theme), it will be very difficult to maintain that table.

However, there are techniques to mitigate this error, which I will offer you one of them.

The solution consists in making two tables, which in one stores the general information of the form and later the table of "metadata" stores the fields (Inputs) with the following characteristics:

  • Form_ID: Indicates which form is
  • Correlative: Incremental auto key increases
  • Key: Unique identifier that recognizes the entry of a respective form
  • Type: The type of the key (Integer, Boolean, Chains, among other more ...)
  • Value: The value that corresponds to the key.

In case you want to delete or add a new field, you should follow the following steps:

  • Add : Just add a new row in the metadata table
  • Delete : You only have to delete the rows, starting with the brackets and Form_ID (Where Form_ID = {FORM_ID} AND key = {Key})

I'll attach an example:

Relationship entity diagram

Example

I hope I have helped you greetings.

    
answered by 27.03.2018 / 17:34
source