🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Select Statement & files open

#1158
From: Dan Barbaria
Date: Wed, 22 Apr 1998 00:00
89 lines
3509 bytes
Romain Strieff [TeamB] wrote:

> Can you show us a few lines of your code? Or at least a more complet
> description of how and what you are doing?
>
> --

Romain this is a small sample of the code.  This executes every time an
order is entered.  There are several more Select statements in other
parts of the application that execute each time an order is entered.

Procedure PUSHBUTTON1_OnClick
   errchk = ""
   *This section checks that a correct action has been selected
   if form.action.value = "A" .or. form.action.value = "E"
      errchk = ""
      else
      store "Incorrect Action Code entered.  " to errchk
   endif && if form.action.value = "A" .or. form.action.value = "E"

   store form.jobnumber.value to mjobnumber
   caps_stat  && Records Caps lock status and turns caps lock off
SELECT job.job_id FROM covmgr.job job WHERE (job.job_id=:mjobnumber)
   caps_reset && resets Caps lock back to where the user hadit
   if form.action.value = "A"
    locate for job_id = mjobnumber
     if .not. found() .and. mjobnumber > 1
      close table
     else
      close table
      errchk = errchk + "Can't Add Job Number "
+noc(form.jobnumber.value)+" it is already used or is not a valid #.  "
    endif && if .not. found() .and. mjobnumber > 1
   endif && if form.action.value = "A"

   if form.action.value = "E"
      locate for job_id = mjobnumber
           if .not. found() .or. mjobnumber = 0
            close table
            errchk = errchk + "Can't Edit Job Number "
+noc(form.jobnumber.value)+ " it is not in the system.  "
            endif && if .not. found() .or. mjobnumber = 0
   endif &&if form.action.value = "E"
   close table

   **This section checks the customer number and saves data to memory
variables if ok
   store form.custno.value to m_custno
   caps_stat
SELECT customer.cuid, customer.cunm, customer.cua2, customer.cua1,
customer.cua3, customer.cuz, customer.cuph FROM covmgr.customer customer
WHERE (customer.cuid=:m_custno)
   caps_reset
   locate for cuid = m_custno
   if .not. found() .or. m_custno = 0
    CLOSE TABLE
    errchk = errchk+ "Customer # " + noc(m_custno)+ " is not valid.  "
    else
    mjob_cua1 = cnn(cua1)
    mjob_cua3= cnn(cua3)
    mjob_zip_code = cnn(cuz)
    mjob_phone = cnn(cuph)
    Close table
   endif  &&if .not. found() .or. m_custno = 0

   store form.employee.value to mjob_sale_id
   caps_stat
   SELECT sp_id, sp_name FROM covmgr.salesper salesper  WHERE
(salesper.sp_id=:mjob_sale_id)
   caps_reset
   locate for sp_id = mjob_sale_id
   if .not. found()
    errchk = errchk + "Employee # is not valid.  "
    close table
   endif
   CLOSE TABLE





--
Dan Barbaria
Printing Plant Supervisor
Omaha Public Schools
________________________________________________
Visit the "Unofficial Covalent ShopSystem Users Web Page at:
WWW.top.net/barbaria
Technical Details
Message-ID: <353E0C49.3B6EB3F0@top.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <353CD734.2C933D03@top.net> <MPG.fa6dd102e853b3298ac30@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,1db6d06459b7da87
X-Google-Attributes: gidff5a1,public
From: Dan Barbaria <barbaria@top.net>
Subject: Re: Select Statement & files open
Date: 1998/04/22
Message-ID: <353E0C49.3B6EB3F0@top.net>
X-Deja-AN: 346635524
Content-Transfer-Encoding: 7bit
References: <353CD734.2C933D03@top.net> <MPG.fa6dd102e853b3298ac30@forums.borland.com>
X-Priority: 3 (Normal)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.vdbase.data.sql