Example:
For example, enter username, password, email, and telphone in the field name.
Note: different field names are separated by commas (,) and asterisks are not supported.
Enter the name of the table to be queried, for example, Table1.
Front-end form page:
Pay attention to the name attribute of the input field.
Commonly used add data under ASPCodeYes:
Use ADODB. recordset
The advantage is that the database is relatively simple to store in the database, so you do not need to consider single quotation marks. It is not prone to errors.Copy codeThe Code is as follows: username = request ("username ")
Password = request ("password ")
Email = request ("email ")
Telphone = request ("telphone ")
SQL = "select * From Table1"
Rs. Open SQL, Conn, 1, 3
Rs. addnew
RS ("username") = Username
RS ("password") = Password
RS ("email") = Email
RS ("telphone") = telphone
Rs. Update
Rs. Close
The second method is to use SQL data to achieve high storage efficiency, but it is prone to problems. single quotation marks and other issues need to be considered.
The above code is actually an encapsulation of SQL insert statements.Copy codeThe Code is as follows: Set conn = server. Createobject ("ADODB. Connection ")
'Create recordset object Method
Set rst = server. Createobject ("ADODB. recordset ")
Set rst1=conn.exe cute ("insert into user (u_user, u_pass) values ('" & request. form ("u_user") & "','" & request. form ("u_pass ")&"')")
Friendly reminder: In order to ensure security, in many cases, the user's input content needs to be converted in a sense. For example
Username‑server.html encode (Request ("username "))
In this way, some scripts are not run, for example, <SCRIPT> will become <SCRIPT>