Information is divided into three types: data sources, controls, and binding information.
{XX} indicates the part to be replaced by the actual value.
Data source: Use hidden, name = DS $ {ID }$ {updatable}, value = {SQL }$ {keys} $ ~ {Kv1}, {kv2 },...~ {Kv3}, {kv4}
Controls: Name = {ID}, value = {value}
Additional properties of the control: name = pro $ {controlid}, value = {p1 $ P2 $ P3}
Binding information: generate one for each bound control. Use hidden, name = dB $ {controlid }$ {Ind }$ {DS}, value = {DF }$ {datatype}
DS $ is the fixed start of the data source ID, and DB $ is the fixed start of the bound ID, used for identification.
{ID} indicates the id value of the control, {SQL} indicates the SQL value of the data source, {keys} indicates the keys value of the data source, and {kvx} indicates the data of the corresponding key.
{Value} indicates the value of the control.
{Controlid} indicates the ID of the control corresponding to the binding information, {DS} indicates the corresponding data source, {DF} indicates the corresponding data field, and {Ind} indicates the corresponding row index, {datatype} indicates the Data Type of the corresponding field.
processing when saving:
1. request. the data in form is divided into three hashtable, and the key and value whose name starts with "ds $" and ends with "$1, htdatabind stores the key and value whose name starts with "DB $", and htcontrol stores the remaining key and value.
2. process the SQL statements of each element in htdatasource and obtain its tablename using regular expressions. Its keys and keysvalues are constructed by using the key of htdatasource as the key, tablename and (keys, keysvalues structure array, generate a hashtable named httable.
3. process each element of the httable Elea:
3.1 pair of Elea. key, and the {DS} in the search value is Elea. eleb. DF and eleb. IND ; according to eleb. the {controlid} of the key obtains the elec element in the htcontrol and obtains the Elec. value.
3.2 If eleb. IND> Elea. value. keysvalues. count, the insert statement is generated: Combine all eleb. DF and Elec. value, plus Elea. tablename generates insert; otherwise, an update statement is generated to combine all eleb. DF and Elec. value generation set clause, elec. keys and elec. keysvalues (IND) generates the WHERE clause, plus Elea. tablename generates update XXX set XXX Where xxx.