Android Question Problem Updating Table

Makumbi

Well-Known Member
Licensed User
B4X:
    Starter.SQL1.ExecQuery2("UPDATE Register SET Phone = ? WHERE Phone = ?", Array(Array As String(Newnumber.Text), Array As String(Oldn.Text)))

error
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
ExecuteHtml: SELECT Names,Class As CS,Stream As Str,Amount,Dates FROM student
** Activity (main) Pause, UserClosed = false **
** Activity (numberchange) Create, isFirst = true **
** Activity (numberchange) Resume **
Error occurred on line: 110 (Numberchange)
java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.String[]
    at de.amberhome.slidemenuexample.numberchange._button1_click(numberchange.java:442)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:733)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:355)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:5610)
    at android.view.View$PerformClick.run(View.java:22265)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (starter) Destroy (ignored)**
** Activity (numberchange) Pause, UserClosed = true **
 

Peter Simpson

Expert
Licensed User
Longtime User
Hmm,
From memory @Makumbi, you should be using ExecNonQuery2. Plus you are trying to update the table with the query method when you should be using a nonquery method.
B4X:
Starter.SQL1.ExecNonQuery2("UPDATE Register SET Phone = ? WHERE Phone = ?", Array As Object(Newnumber.Text, Oldn.Text))
 
Last edited:
Upvote 0

Makumbi

Well-Known Member
Licensed User
Hmm,
From memory @Makumbi, you should be using ExecNonQuery2. Plus you are trying to update the table with the query method when you should be using a nonquery method.
B4X:
Starter.SQL1.ExecNonQuery2("UPDATE Register SET Phone = ? WHERE Phone = ?", Array As Object(Newnumber.Text, Oldn.Text))
Thank You My Brother it has worked. Long live like a tortoise so that you can spread more knowledge
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top