B4J Question RDC config.properties

alienhunter

Active Member
Licensed User
Longtime User
Hi
did anyone tried a update function like that before ? , it does not work here
where the set column and value is a variable ?

" sql.insert_cols1=UPDATE 030_electrode SET ?=? WHERE EE_Electrode_Name = ? "

error
"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 ''EE_Holder_DispZ'='0.0000' WHERE EE_Electrode_Name = 'el-001-r'' at line 1"

thanks
 

DonManfred

Expert
Licensed User
Longtime User
What is the code you are using (rdc client)?

Additional i´m not sure if you can set a fieldname parametrized
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Is EE_Holder_DispZ defined as a numeric field?, as you are trying to set it to a string '0.0000'
 
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
thank you
:confused: now i have to find a way how to update 108 colums by reading a xml file with RDC


it is working this way
it looks like i cannot pass the same command to the rdc


B4X:
Sub checkupload1(stringx As String,namex As String)
    If stringx.Length>0 Then
        Log("here fail")
        sql1.ExecNonQuery("UPDATE ELECTRODE SET " & namex & nn & " ='"& stringx &"'" & "WHERE EE_Electrode_Name='" & parsql.Replace(".xml","") &"'" )

        Log("here" & namex)
        Else
        Log("nothing here" & namex)
    End If
Return
End Sub


RDC

B4X:
Dim cmd As DBCommand
    cmd.Initialize
    cmd.name ="insert_cols1"
    Dim sv As String
    sv="UPDATE electrode SET " & colx & " = " & Chr(39) & colv & Chr(39) & " " & " WHERE  EE_Electrode_Name = " & Chr(39) & valx & Chr(39)
    Log(sv)
    cmd.Parameters=Array As Object(sv)


the log(sv) is ok
UPDATE electrode SET EE_Spark_EndPosC = '270.000' WHERE EE_Electrode_Name = 'el-008-r'
and it works if you copy and paste in the sql Query

sql.insert_cols1=?;


B4X:
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 ''UPDATE electrode SET UNIT = \'in\'  WHERE  EE_Electrode_Name = \'el-008-r\'' at line 1

it add's "\" to the command EE_Electrode_Name = \'el-008-r\'
 
Last edited:
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
If you are using jRDC(v1/v2) , it's possible to customize your field name in http header ("fieldname=fieldname").

Check if the fieldname is allowed and build the query string (with parameters) yourself
 
Upvote 0
Top