Android Question The code 'cursor=Starter. Mysql_Jdbc. ExecutQuery (strSQL)' reports an error and the reason cannot be found

bskotu555

Member
cx=Button3.Text'程序名
zw=EditText1.text'站位
bt=EditText2.text'物料条码
strSQL ="SELECT * FROM smt WHERE 程序名='" & cx & "' and 站位='" & zw & "'"
Cursor = Starter.Mysql_Jdbc.ExecQuery(strSQL) '查询结果

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
** Service (starter) Start **
Error occurred on line: 71 (B4XMainPage)
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '???='DDSY606-LH-F221290-1' and ??='1-1-F-41'' at line 1
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:403)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1915)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2023)
at anywheresoftware.b4j.objects.SQL.ExecQuery2(SQL.java:343)
at anywheresoftware.b4j.objects.SQL.ExecQuery(SQL.java:324)
at b4a.example.b4xmainpage._edittext2_enterpressed(b4xmainpage.java:392)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.objects.EditTextWrapper$2.onEditorAction(EditTextWrapper.java:107)
at android.widget.TextView.doKeyDown(TextView.java:7584)
at android.widget.TextView.onKeyDown(TextView.java:7453)
at android.view.KeyEvent.dispatch(KeyEvent.java:2692)
at android.view.View.dispatchKeyEvent(View.java:12464)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1901)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1901)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1901)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1901)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1901)
at com.android.internal.policy.DecorView.superDispatchKeyEvent(DecorView.java:428)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1820)
at android.app.Activity.dispatchKeyEvent(Activity.java:3361)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:342)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5044)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4912)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4433)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4486)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4452)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4592)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4460)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4649)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4433)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4486)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4452)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4460)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4433)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4486)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4452)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4625)
at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4786)
at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2571)
at android.view.inputmethod.InputMethodManager.in
Message longer than Log limit (4000). Message was truncated.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…