In SQL databases, it is often difficult to figure out whether to write single quotes or double quotes when writing some statements. After some queries, I agree with the following. Here, the string type is used as an example:
When I have a table named studentname, there is a field named
I want to insert a name named "Zhang San" into it, so
Strtxtsql = "insert into studentname (name) value ('zhang san ')"
Because it is a string, single quotation marks must be placed on both sides of the insert statement. If "Michael" is replaced with a variable A, the statement is:
Strtxtsql = "insert into studentname (name) value ('" & &"')"
Here, if variable A is to replace Michael, it needs to be "& A &", which requires a connector and double quotation marks. In comparison with the above sentence, double quotation marks are used to include variables, A single quotation mark is a value that contains a field.
Here is just a comment on the string quotation marks. Of course, different types are also different, so you must note when writing.