Skip to content
Advertisement

Save VB6 values ​in SQL

I have this interface:

enter image description here

When the add button is pressed, a UserControl with the same fields is added:

enter image description here

So, the question is: How do I save the main values ​​and those that have been added? That is, if the user pressed the add button, how do I also save those values?

Currently, this is the entire interface code:

Advertisement

Answer

Your app allows the creation of any number of UserControls. At some point, you will need to save all this data. One approach is to to loop through those UserControl’s and build an Insert statement. As mentioned in the comments, it is wise to sanitize the input and to use parameters. Something like this:

For simplicity, this code assumes you know the number of UserControl’s. It also builds upon the ideas I presented in this answer. You will need to sanitize the data and add additional Parameters as needed.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement