Home > database >  Which tall person guide genuflect is begged! About the SQLCA. SyntaxFromSQL SQL strange questions
Which tall person guide genuflect is begged! About the SQLCA. SyntaxFromSQL SQL strange questions

Time:11-09

The following code is executed prompt "SQL syntax error", but if it's not select into assigned to str_sql instead of directly using the//part can be normal operation, the SQL statement is a punctuation is not bad, which tall person guide genuflect is begged!

String str_err_sql str_err_create, str_sql, str_syntax sql_memo_str

Select SQL into: str_sql from qhd_wht_sql where submenu_name='11';
//str_sql="select device_number number, cust_name user name, credit_value/100 credit from DWD. Dwd_o_serv_day_182 a, qhd_qyx_number4 b where a.a cct_month='" + sle_1. Text +"' and a. d. ay_id='" + sle_2. Text + "' and Anderson f_valid='1' and a. d. evice_number=b.m y_number "

Str_syntax=SQLCA. SyntaxFromSQL (str_sql, 'style (type=grid)', str_err_sql)
If len (str_err_sql) & gt; 0 then
Messagebox (" error ", "obtain the SQL syntax error")
Return
The else
Dw_2. Create (str_syntax str_err_create)
If len (str_err_create) & gt; 0 then
Messagebox (" error ", "an error occurred when creating data window!" )
Return
End the if
End the if
Dw_2. Settransobject (sqlca)
Dw_2. Retrieve ()

CodePudding user response:

Select SQL into: str_sql... Variable is embedded SQL, used to remove the values in the
From the select device_number number... Is a standard SQL, standard SQL can use SyntaxFromSQL

CodePudding user response:

reference 1st floor SBKS response:
select SQL into: str_sql... Variable is embedded SQL, used to remove the values in the
From the select device_number number... Is a standard SQL, SQL can use SyntaxFromSQL


Thank you for your advice, the main problem is the SQL to contain parameters, if no parameter is to perform a success, but what is the alternative method? I want to achieve is to use the database to save the SQL generated dynamic data window, give a way of thinking or other!

CodePudding user response:

. '" + sle_1. Text + "..
As a string!

You this table qhd_wht_sql don't simply use SQL, changed to 2 column
SqlFrom
SqlWhere

CodePudding user response:

LZ do you want to do with parameters?

CodePudding user response:

Out of the database containing.. '" + XXX. Text + "'. Strings, find XXX (name of the singlelineedit), through the window, achieve called xxxsinglelineedit reference, get XXX. The value of the text yyy, with yyy finally replace 'XXX. The text', joining together to complete the SQl, then SyntaxFromSQL

CodePudding user response:

Out of the database containing.. '" + XXX. Text + "'. Strings, find XXX (name of the singlelineedit), through the window, achieve singlelineedit object references, called XXX in XXX. The value of the text yyy, with yyy finally replace 'XXX. The text', joining together to complete the SQl, then SyntaxFromSQL

CodePudding user response:

refer to 6th floor sjlion response:
containing. Out of the database. '" + XXX. Text + "'. Strings, find XXX (name of the singlelineedit), through the window, achieve singlelineedit object references, called XXX in XXX. The value of the text yyy, with yyy replace 'XXX. The text' finally, joining together to complete the SQl, and then you can SyntaxFromSQL


Exclude okok, thank you very much, finally done, I use the pos () and replace () function orientation in the replacement string variables, restructuring has assignment in stitching way SQL statements, perform a success, share with you,
  • Related