Home > database >  Pb SQL queries
Pb SQL queries

Time:10-05

String oldsql, newsql
String mygetzdid mygetcon, mygetvalue mycolumnname, mytablename
Int I, stringlen
Select the trim (columnname) into: mycolumnname from query;
Mytablename=parent. Ddplb_tablename. Text
Oldsql=parent. Dw_result. Getsqlselect ()
Newsql='

If the parent. Dw_condition. Rowcount () & lt;> 0 then
The parent. Dw_result. Retrieve ()
Oldsql=parent. Dw_result. Getsqlselect ()
For I=1 to the parent. Dw_condition. Rowcount ()
Mygetzdid=trim (parent. Dw_condition. Getitemstring (I, "columnname"))
Mygetcon=trim (parent. Dw_condition. Getitemstring (I, "controlname"))
Mygetvalue=https://bbs.csdn.net/topics/trim (parent. Dw_condition. Getitemstring (I, "columnvalue))
Newsql=newsql + "+" (" + "' + '"' + string (mytableid) + '"' +", "+ & amp;
'+' "+ string (mygetzdid) + '"' + string (mygetcon) + '"' + string (mygetvalue) + & amp;
'+' "+") "+ 'a' + 'and'
End for
Newsql=oldsql + 'a' + 'where' + newsql
Stringlen=len (newsql)
Stringlen=stringlen - 5
Newsql=trim (left (newsql, stringlen))
The parent. Dw_result. Setsqlselect (newsql)
The parent. Dw_result. Retrieve ()
The else
Messagebox (" reminder ", "please set the query conditions." )
End the if

When running the error:
Select error: sqlstate=s1000
[oracle] [odbc] [ora] ora - 00933 SQL command not correct end

Who can help me to change!

CodePudding user response:

There are two possible:
1 assembly SQL syntax has a problem, in itself,
2, into the variable of the SQL statement contains illegal characters, usually contain "'"

CodePudding user response:

End for change to next

In setsqlselect (newsql) using messagebox pop out in front of the newsql, see if there is something wrong with statements can also set breakpoints debugged

CodePudding user response:

Eject messagebox newsql information (* is I used to take the place of the field!)
Where the select * * and * and
The end there will be one more and oh, is not the problem!
How to get rid of and behind!

CodePudding user response:

Stringlen=stringlen - 5 can't remove the back of the + + and oh! I don't know why?

CodePudding user response:

A little difficulty oh
  • Related