Android Question RDC SQL LIKE Operator

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Hello friends

I am developing an application in B4A connected directly to SQL Server using RDC,
following the link: https://www.b4x.com/android/forum/t...connector-rdc-connect-to-any-remote-db.31540/

The query in SQL Server is the following:

VaXGEOo.png


The query is in the RDC Config file:

kr5DuJK.png


The query is executed in the RDC log

Llr7KCm.png


The problem I have is when I use the LIKE operator in a SELECT query, in the smartphone it shows all the records and that query should only return 5 records


Thank you for your assistance
 

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Hi Erel

1. I thought that jRDC2 was only for B4J and not for B4A

2. The examples I found are only for B4J

That's the reason why I use RDC

I would appreciate it if you can give me an example using jRDC2 (SQL Insert and Select operators)

Thank you very much for your help
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
what about replacing

like '%?%'

with

in ('?')

?

the wildcards are then gone.
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
what about replacing

like '%?%'

with

in ('?')

?

the wildcards are then gone.

Hi sorex

Make the change you tell me the sql query was like this:

SELECT NIT, Suc, Name, Address, City, LP, Seller_ID FROM Customers WHERE Name in ('?')

When executing it in the SmartPhone it does not return any record
 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
Maybe you want use SQL Server Profiler in your server, and monitor the sentence received by DB Engine.
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Maybe you want use SQL Server Profiler in your server, and monitor the sentence received by DB Engine.

Hi Jorge MA

Look, I did the test in the SQL Server Profiler

Here are the results:

jbhUed6.png


Performing the query with the IN operator in SQL Server Mannagent Studio does not show any record, see image:

GdDkEPJ.png


The problem seems to be in the LIKE operator, all the other queries I do work well.

Thank you
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
oh wait, you do a search in larger content. IN is mainly to match a non wildcard string.

my bad, sorry.
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
@Jorge M A

It seems that the wildcard (?) Sent from the RDC's config file does not send anything to the LIKE operator in the SQL Server Database. See the image of the SQL Server Profiler

YMAZyn1.png


If I do this same query in the SQL Server Mannagent Studio, the same result is returned which returns all the records in the table, see the image

eTgFJNm.png


The idea is that you can use the operator like the wildcard (?) Should send this to the database engine.

Thank you
 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
This is not the way that MS SQL works. The quotation mark (?) defines the PARAMETER substitution to be used.
But your issue is not MS SQL, but in JDBC driver and the PREPARED statement. JDBC is out of my experience.
maybe you want read the official documentation here.
 
Upvote 0

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Hi @Erel

I have already started jRDC2 connected with MS SQL Server, the test works fine.

You have an example of the B4A client connected to a MySQL or SQL Server database by jRDC2?

Thank you very much.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 0
Top