Android Question Passing parameters to ExecQueryAsync

Discussion in 'Android Questions' started by Fayez Boulos, Feb 14, 2019.

  1. Fayez Boulos

    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
     
  2. Computersmith64

    Computersmith64 Well-Known Member Licensed 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.
     
  3. DonManfred

    DonManfred Expert Licensed User

    it should be Array(147)
     
    Last edited: Feb 14, 2019
  4. DonManfred

    DonManfred Expert Licensed User

    Please use [CODE]code here...[/CODE] tags when posting code.

    [​IMG]
    [​IMG]
    [​IMG]
     
  5. Fayez Boulos

    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
    Code:
    ....
    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

    Code:
    Dim sf As Object = RemoteSQL.ExecQueryAsync("RemoteSQL""SELECT * from package where package_id=?"Array(147))
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice