sql.select_articulos_precios=Select a.CODIGO, a.CODIFICADO, a.NOMBRE, a.PVENTA, a.PVENTA_2, a.PVENTA_3, a.PVENTA_4, a.PVENTA_5, a.DOLARIZADO From ARTICULO a \
Donde a.FECHAEGRE = "0000-00-00" y Substr (a.NOMBRE, 1,?) =? ordenar por un.NOMBRE Limite 0,?
But when using it, it throws the following error: <pre> 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 ''300'' at line 1</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>
I use 300 as a limit.
If I do the same query from MySQL Query Browse, it works fine.
What can I be doing wrong in the query inside "config.properties"
Greetings[/CODE]
B4J SQL library. Contribute to AnywhereSoftware/B4J_SQL development by creating an account on GitHub.
github.com
and this other: con.ExecQuery2(Main.rdcConnector1.GetCommand(cmd.Name), cmd.Parameters)
B4X:
Public Sub GetCommand(Key As String) As String
If commands.ContainsKey("sql." & Key) = False Then
Log("*** Command not found: " & Key)
End If
Return commands.Get("sql." & Key)
End Sub
I think passing parameters as object type should work.
Change:
B4X:
Dim aCom() As Object = Array (nCar,cFiltro,MinPro,MaxPro,MinLin,MaxLin,MinRub,MaxRub, nLimit)
B4X:
GetRecord (Command As String, parameters() As Object) As ResumableSub
B4J SQL library. Contribute to AnywhereSoftware/B4J_SQL development by creating an account on GitHub.
github.com
and this other: con.ExecQuery2(Main.rdcConnector1.GetCommand(cmd.Name), cmd.Parameters)
B4X:
Public Sub GetCommand(Key As String) As String
If commands.ContainsKey("sql." & Key) = False Then
Log("*** Command not found: " & Key)
End If
Return commands.Get("sql." & Key)
End Sub
I think passing parameters as object type should work.
Change:
B4X:
Dim aCom() As Object = Array (nCar,cFiltro,MinPro,MaxPro,MinLin,MaxLin,MinRub,MaxRub, nLimit)
B4X:
GetRecord (Command As String, parameters() As Object) As ResumableSub
Thank you very much for your patience and detailed explanations. It finally WORKS by making those little changes.
NOTE: At first I thought that if I modified "GEtRecord" from String to Objet, I had to change ALL the calls (currently my APP has more than 100), but obviously B4X internally makes the passage from String to Objets automatically, since I did not have I had to modify none and the APP kept connecting correctly !!! .... a genius!
Basically when I need a variable "LIMIT" from the APP, I use this syntax, otherwise I keep sending a string array and it works.