Subject ADO Query Parameters
From Kinsley <kinsleyr@gmail.com>
Date Tue, 15 Sep 2020 16:40:41 -0400
Newsgroups dbase.getting-started

Hi all,

I need to move a dbase application over to a new server - the servers were 2002 on the old one and 2016 on the new one.

I've tried to recompile the application and it appears to work up to the point that it gets the data. The request fails to populate a Grid as I am setting parameters in the Form_Open function

What I have is as follows:

this.ADODATABASE1 = new ADODATABASE(this)
   with (this.ADODATABASE1)
      left = 31.0
      top = 17.0
      connectionString = "Provider=MSDASQL.1;****" //taken out for security
      active = true
   endwith

this.ADOQUERY1 = new ADOQUERY(this)
   with (this.ADOQUERY1)
                left = 91.0
                top = 21.0
      database = form.adodatabase1
      connected = true
      l1 = "select * from com forms  t WHERE c.tutref LIKE :TT AND processed LIKE :PP AND monthlist LIKE :MM AND (commyear LIKE :YY OR commyear LIKE :YY2)"        
      sql = l1
      active = true
   endwith

   with (this.ADOQUERY1.rowset)
      onNavigate = class::ROWSET_ONNAVIGATE
   endwith

   function form_onOpen()
                nthisyear = year(date())
                nlastyear = year(date())-1
                with (form.adoquery1)
                        params["TT"].value = "%"
                        params["PP"].value = "F"
                        params["MM"].value = "%"
                        params["YY"].value = nthisyear
                        params["YY2"].value = nlastyear
                endwith
                form.adoquery1.requery()

This does not work.

If I then rip out the parameters and put in the values as this:

      l1 = "select * from com forms  t WHERE c.tutref LIKE '%' AND processed LIKE 'F' AND monthlist LIKE '%' AND (commyear LIKE 2020 OR commyear LIKE 2019)"        

Then I get records back that I would expect. Any ideas what I am doing wrong please as I have looked at the language reference and don't see any issues with my code.