Home > Back-end >  Inserted into the database
Inserted into the database

Time:09-27

In a Groupbox have multiple boxes,
The diagram below:

The data table structure for

I set up
A1 Checkbox is selected for data table 1 2 4 6 of 8 update data
A2 Checkbox is selected for data table 9 11 12 13 update data
For example,
I chose the A1 Checkbox, number 5 submission is to insert a record data list
The data in the table records for:
I chose the A2 Checkbox, number is 6 points to submit to insert a record data list
The data in the table records for:
Other Checkbox corresponding to the other fields, like this need
I wrote how convenient database? With 12 boxes, in actual application, the corresponding field also many,
Consult this a good way!

CodePudding user response:

His top!

CodePudding user response:

Can combine the checkBox. Hint, hint can be stored in fields, such as the format fieldA fieldB, fieldC) to deal with, so you don't need to write a bunch of code,
All the checkBox onclick can unified handling

If (not TCheckBox (sender). Checked) or (StrToIntDef (edtNum. Text, 0) & lt;> 5) then the exit;
//analytical fields and assembled SQL script
//write data...

CodePudding user response:

Looking at pictures, is operating the EXCEL table?
Local directly with you (such as ADOQuery) EDIT, then we have to do is POST

Submit there to join code:
AdoQuery1. Edit;
For I:=0 to groupbox1. Do ControlCount - 1
If groupbox1. Controls [I] the ClassName='TCheckBox' then
The begin
AdoQuery1. Fields [TCheckBox (groupbox1 Controls [I]). The Tag]. AsString:=edtSL. Text;//here for a moment with the CHECKBOX of the TAG to mark your field, the rules themselves think again good,
The end;
AdoQuery1. Post;

CodePudding user response:

The building Lord still honestly write code, for every check box to write a SQL update feature, chose a few can run when submitted to see a few.

CodePudding user response:

reference 4 floor tcmakebest response:
the building still honestly write code, for every check box to write a SQL update feature, when submitted to chose a few run several. See

Don't you think it's stupid?

CodePudding user response:

reference 5 floor elegant_style reply:
Quote: refer to 4th floor tcmakebest response:

The building Lord still honestly write code, for every check box to write a SQL update feature, chose a few can run when submitted to see a few.

Don't you think it's stupid?

Yes, there is such a stupid design, is how stupid the implementation of a ring set of a ring

CodePudding user response:

If regularly, you can implement this rule in the code, if there is no law, or to write the code, the corresponding relationship or preserve each CheckBox in a table corresponding to those columns in a table, finally to spell out the Insert statement in the code through this table, perform,

CodePudding user response:

refer to 7th floor ZBDZJX response:
if there is a law, can implement this rule in the code, if there is no rule, or write corresponding relationship to the code, or use a table to save each CheckBox correspond to those columns in a table, and finally through the table to create Insert statements in your code, execution,

No rules!

CodePudding user response:

No rule is bad to deal with, is simply a few can also, if more than ten more,
Basic method or using a loop to handle:
1. Can set the checkbox controls to an array of controls (D control array no convenient)
(2) for each checkbox to specify corresponding field array
3. Circulation judge whether each checkbok control is selected, if selected according to insert the data corresponding to the length of the array of cycle

CodePudding user response:

Still have a certain amount of code,

CodePudding user response:

refer to the eighth floor elegant_style response:
Quote: refer to 7th floor ZBDZJX response:

If regularly, you can implement this rule in the code, if there is no law, or to write the code, the corresponding relationship or preserve each CheckBox in a table corresponding to those columns in a table, and finally through the table to create Insert statements in your code, execution,

No law that


Without rules, the corresponding relations between writes code, or saved to a database table, then spell SQL statements,

CodePudding user response:

What is the method? The great god



CodePudding user response:

A better way is through SQL Insert statement, inserts,
A statement inserts a row,

CodePudding user response:

To be honest, a little confused

CodePudding user response:

Or insert code, method have but don't read the insert,

CodePudding user response:

The
reference 13 floor lyhoo163 reply:
better way is through SQL Insert statement, inserts,
A statement inserts a row,


A a plug, is there a better way than this

CodePudding user response:

On the 14th floor jozosoft
reference response:
to be honest, a little confused

It is easy to understand.
Corresponding digital library is a Checkbox few field to select the Checkbox to the database insert values of these fields

CodePudding user response:

Say my thinking
1, first of all need a table to hold the Checkbox corresponding which fields, and when the program runs to the corresponding table data is loaded into the data sets or memory table,
2, the key is to write a process through the checkBox, according to whether the corresponding to the selected from the load data sets or memory table screen fields,
3, there are two kinds of schemes for submit data, code, or SQL, or save the data set and then submit first,
I don't know, any good ideas, a great god

CodePudding user response:

Or insert

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related