SQL:='select * from dw where DWMC=' + DWMC so write wrong
SQL:='select * from dw where DWMC=' "+ +" 'DWMC so not write
How to write
DWMC is a variable of type character database using SQL server2008
CodePudding user response:
SQL:='select * from dw where DWMC=' DWMC '+ +' ' ' 'CodePudding user response:
If you want to use single quotation marks between two single quotes, use two single quotes to represent a single quotation marksCodePudding user response:
You can also use QuotedStr functionSQL:='select * from dw where DWMC=' + QuotedStr (DWMC);
CodePudding user response:
Literally, you are right, the secondAs for the error, the program inside the breakpoints, enable SQL event tracker to see specific execution of SQL statements, copied to the query editor and see what is the problem
CodePudding user response:
Better write like this:SQL:='select * from dw where DWMC=' + # 39 + DWMC + # 39
CodePudding user response:
The second sentence last a single quotation marksCodePudding user response:
Express or change your code with parameterSQL:='select * from dw where DWMC=' DWMC '+ +' "'
CodePudding user response:
One more quoteSQL:='select * from dw where DWMC=' '+ DWMC +' ' '
CodePudding user response:
SQL:='select * from dw where DWMC=' "+ +" '"' DWMC back without a single quotes,CodePudding user response:
The building Lord thoroughly learn the use of the Delphi quotes,CodePudding user response:
SQL:='select * from dw where DWMC=' + QuotedStr (DWMC); I am using this method, save troubleCodePudding user response:
1. The two single quotes in single quotation marks in the Delphi said a single number2. Use QuotedStr, they don't have to take into account the issue of quotation marks
CodePudding user response:
Variable name don't call SQLSTR is commonly used in SQL statement isSQLSTR:='select * from dw where DWMC=' DWMC '+ +' "';
CodePudding user response:
It is best to use the format to write, so try to avoid count number 'SQLSTR:='select * from dw where DWMC=' DWMC '+ +' "';
Use the format is SQLSTR:=format (' select * from dw where DWMC=', '% s'' ', [DWMC]); % s is refers to the character, if the plastic is % d format (' select * from dw where DWMC=% d ', [DWMC]); , floating-point is % f format (' select * from dw where DWMC=% f ", [DWMC]);
CodePudding user response:
DELPHI grammar mistakes: first.SQL:='select * from dw where DWMC=' + DWMC so write wrong
SQL:='select * from dw where DWMC=' "+ +" 'DWMC so not write
Correct grammar is: SQL:='select * from dw where DWMC=' + ' '+ DWMC +' ';
Or: SQL:='select * from dw where DWMC=' + QuotedStr (DWMC);
2. The grammar of the SQL SERVER 2008 problems
Whether the SQL SERVER 2008 field case problems (I have not studied the SQL SERVER 2008), but the oracle is case-sensitive, this you note that
If you have any exception prompt box screenshots, good judgment