This article assumes the reader has some understanding of database connectivity technologies, only to discuss the SQL query syntax.
Table structure is as follows (MS Access 2000):
table name: userTable
----- -----------------
field name segment type
----------------------
userID automatically count (long integer)
userName text
user *** Text
CreateDate date / time (default Now ())
------------ ----------
one, with the Select command to extract the Record
1, to obtain all the records in the table
Select command, the statement is as follows:
\ userTable \ \ Like '% M%' \ The above command can be combined, for example, to obtain the table contains userName \ Like '% Ho%' Order By CreateDate DESC \ SQL query command.
3), conditions of the word in the \
4), determine the conditions when more than one should be to \
Second, with the Insert Into command to insert a new record
1, insert a new record
\ br> Description:
It should be noted that the value inserted into the types of records should be consistent with the type field in the table, otherwise it will go wrong. In fact, just using single quotes and convenient method, but not standardized,
air force one low, because if you want to insert the record itself contains single quotes, an error (although this does not happen often, but there may exist). So we best to use a custom function to replace the single quotes. As follows
Function SqlStr (data)
SqlStr = \ Function
in the command was:
Dim Name,
air force 1 shoes, ***
Name = \ userName,
cheap air force ones, user ***) Values (\ or double quotes are not wrong.
Note, however, this rule applies only to type the text field, if other types are generally no need to consider that do not add any symbol.
three,
air force ones, with the Update to update records
1,
air force one, update all records all fields
\ = \
2, update the userName field value, \
combination of conditions necessary inquiries, the method with the Select. Another issue here should pay attention to single quotes.
Fourth,
air force 1 classic mid, Delete to delete records
1, delete all records
\; Delete From userTable Where userID = 20 \ *= 'F' And userName Like '% Zhang%' \