Android Question Passing parameters to ExecQueryAsync

Fayez Boulos

Member
Licensed User
Hi,
I am trying to execute a statement against MS SQL server. The statement is

Dim sf As Object = RemoteSQL.ExecQueryAsync("RemoteSQL", "SELECT * from package where package_id=?", Array As Int (147))

But it does not return any rows (Crsr has no rows). If I use select * from package without the where clause, I get all the rows correctly... and most strangely if I use select * from package where package_id=147 I get no rows !!

Can someone help me resolving this issue, and what will happen if I execute a command to run a stored procedure which needs parameters. Your help is appreciated. Thanks
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
A bit more info would be useful. What is the type of package_id? Are you certain there is a row where package_id = 147? Maybe also provide the code you are running, because you're making references in your question to objects that aren't shown in what you have posted (ie: Crsr).

My guess (without any other info) is that if there is a row where package_id = 147, the datatype is a string & therefore you would need to change your parameter value from an Int to a String - however instead of Array As Int(147) or Array As String("147"), just do Array(147) or Array("147"). That way, when you have to provide values for parameters of mixed types you can just put Array(147, "Blah")

- Colin.
 
Upvote 0

Fayez Boulos

Member
Licensed User
Thanks Colin and DonManfred, I used Array(147) and it worked, and Colin explanation answered one of my potential questions of using a combination of int, string array of parameters.. I appreciate your help as usual.

I will try here to use
B4X:
....
for trial to see how it works, however, my thread is completed successfully... My apologies I am still learning very new environment to me. Thanks again

B4X:
Dim sf As Object = RemoteSQL.ExecQueryAsync("RemoteSQL", "SELECT * from package where package_id=?", Array(147))
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…