🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #1379

Using Variables in SQL statements

#1379
From: Judy and Frank Button
Date: Sun, 11 Jan 1998 00:00
118 lines
3453 bytes
I have been trying to use a variable to substitute a value for WHERE in
an SQL statement.  I have attached a bit of code.  The Table name is
L28Class.dbf the field that I am using is Year_Paid. mYearPaid is the
variable.  The form works as written but I have 2 problems. 

1) Anytime I try to edit the SQL from the inspector as I close the
editor I get an error " variable mYearPaid not Defined".  I close anyway
and the Active property resets to False from True and when I open the
Params property the data type has changed from Numeric to Logical.  When
I change the data type back to Numeric set the value to a number and
then set active to true the form works fine.

2) Once I have conquered this problem I am going to want to change the
value of mYearPaid to be able to vary the results of the query.  I was
going to use a PushButton on Click event.  Will that work??

** END HEADER -- do not remove this line
//
// Generated on 01/11/98
//
parameter bModal
local f
f = new lAser28MembersForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class lAser28MembersForm of FORM
   set procedure to "D:\PROGRAM FILES\BORLAND\VISUAL
DBASE\CUSTOM\DATABUTTONS.CC" additive
   with (this)
      scaleFontBold = false
      height = 16
      left = 28.5714
      top = 0.5909
      width = 40
      text = ""
   endwith


   this.L28CLASS1 = new QUERY()
   this.L28CLASS1.parent = this
   with (this.L28CLASS1)
      left = 1
      top = 0.4545
      sql = 'select * from "L28CLASS.DBF"  WHERE Year_Paid >=
:mYearPaid'
      params["mYearPaid"] = 1997
      active = true
   endwith


   with (this.L28CLASS1.rowset)

      indexName = "LAST"
   endwith


   this.ENTRYFIELDLNAME1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELDLNAME1)
      height = 1
      left = 4.7143
      top = 4.7727
      width = 22
      metric = 0	// Chars
      dataLink = form.l28class1.rowset.fields["LNAME"]
      colorHighLight = ""
      borderStyle = 7	// Client
   endwith


   this.BITMAPPREVIOUS1 = new BITMAPPREVIOUS(this)
   with (this.BITMAPPREVIOUS1)
      height = 1.4545
      left = 7.4286
      top = 8.0455
      width = 4.5714
      metric = 0	// Chars
      group = false
      value = false
   endwith


   this.BITMAPNEXT1 = new BITMAPNEXT(this)
   with (this.BITMAPNEXT1)
      height = 1.4545
      left = 12
      top = 8.0455
      width = 4.5714
      metric = 0	// Chars
      group = false
      value = false
   endwith


   this.TEXTLNAME1 = new TEXT(this)
   with (this.TEXTLNAME1)
      height = 1
      left = 9.5714
      top = 3.7727
      width = 13.7143
      metric = 0	// Chars
      wrap = false
      colorNormal = "BtnText/BtnFace"
      alignVertical = 1	// Middle
      alignHorizontal = 1	// Center
      text = "Last Name"
   endwith


   this.rowset = this.l28class1.rowset
endclass

Frank Button
Technical Details
Message-ID: <34B8F5DD.C6323712@globalserve.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,32974d6c1392a356,start
X-Google-Attributes: gidff5a1,public
From: Judy and Frank Button <laser@globalserve.net>
Subject: Using Variables in SQL statements
Date: 1998/01/11
Message-ID: <34B8F5DD.C6323712@globalserve.net>
X-Deja-AN: 314968781
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Organization: None
Mime-Version: 1.0
Newsgroups: borland.public.vdbase.data.sql