Thanks Fred! I was not aware I could use AERROR(), but it gave me the answers I needed. I am guessing a TRY CATCH would work here too?

Jeff

Jeff Johnson
SanDC, Inc.
(623)-582-0323

www.san-dc.com <http://www.san-dc.com>
www.cremationtracker.com <http://www.cremationtracker.com>
www.arelationshipmanager.com <http://www.arelationshipmanager.com>


On 1/3/2014 9:59 AM, Fred Taylor wrote:
For a more detailed error about what happened in the SQL, you can use
AERROR() after you get your return status of -1.

Fred


On Fri, Jan 3, 2014 at 9:30 AM, Jeff Johnson <[email protected]> wrote:

Frank:  It is not working and of course all I get is a -1 returned.
  Should there be  ";" line continuations in there?  Also, any reason why
you put the commas in front instead of behind the varuable?

TIA


Jeff

Jeff Johnson
SanDC, Inc.
(623)-582-0323

www.san-dc.com <http://www.san-dc.com>
www.cremationtracker.com <http://www.cremationtracker.com>
www.arelationshipmanager.com <http://www.arelationshipmanager.com>


On 1/3/2014 4:52 AM, Frank Cazabon wrote:

I'm not seeing any problems there.  Maybe you could add in a query for
the record you just inserted to see if it was inserted.

Here's how I would do it, checking if the record inserted successfully,
only for testing's sake:

* I would change your SQL to use parameters all the way through,
* Code like this would be faster/easier to maintain but you can ignore it
if you want:

TEXT TO m.lcSQL NOSHOW TEXTMERGE
     INSERT INTO SQLSERVERTABLE (
             DP_WKSEQNO
             ,DP_WKCOMPANY_PS
             ,DP_WKPAYGROUP_PS
             ,DP_WKPAYGROUP
             ,DP_WKDATE
             ,DP_WKTRIPNO
             ,DP_WKTRIPQ
             ,DP_WKEVENT
             ,DP_WKSTDATE
             ,DP_WKSTTIME
             ,DP_WKENDDATE
             ,DP_WKENDTIME
             ,DP_WKMINS
             ,DP_WKSTAT
             ,DP_WKDRIVER
             ,DP_WKCODE1
             ,DP_WKCODE2
             ,DP_WKLOC
             ,DP_WKACCNT
             ,DP_WKHUB
             ,DP_WKTODMILES
             ,DP_WKMIMARK
             ,DP_WKWEIGHT
             ,DP_WKQUANT
             ,DP_WKHOOK1
             ,DP_WKPAYCODE
             ,DP_WKGUID
             ,DP_WKDATETIME
             ,DP_WKSTATUS
             ,DP_WKPROCESSED)
        VALUES (
             ?m.wkseqno
             ,?m.pscompany
             ,?m.pspaygroup
             ,?m.wkpaygroup
             ,?m.wkdate
             ,?m.wktripno
             ,?m.wktripq
             ,?m.wkevent
             ,?m.wkstdate
             ,?m.wksttime
             ,?m.wkenddate
             ,?m.wkendtime
             ,?m.wkmins
             ,?m.wkstat
             ,?m.wkdriver
             ,?m.wkcode1
             ,?m.wkcode2
             ,?m.wkloc
             ,?m.wkaccnt
             ,?m.wkhub
             ,?m.wktodmiles
             ,?m.wkmimark
             ,?m.wkweight
             ,?m.wkquant
             ,?m.wkhook1
             ,?m.wkpaycode
             ,?m.wkguid
             ,?m._wkdatetime,
             ,?m.wkstatus
             ,'N')
ENDTEXT


SCAN
     SCATTER MEMVAR MEMO

     lnsuccess = SQLEXEC(lnSQLhandle, m.lcSQL)

     IF lnsuccess < 1

       =MESSAGEBOX('SQL Select failed: ' + TRANSFORM(lnsuccess) + "'" +
m.lcSQL+ "'")
       lclogstring = lclogstring + lcSQL + lccrlf + lccrlf
       EXIT
     ELSE
         * check if record was saved
         lnsuccess = SQLEXEC(lnSQLhandle, "SELECT recinserted =
COUNT(dp_wkseqno) FROM SQLServerTable WHERE dp_wkseqno = ?m.wkseqno",
"c_Result")
         IF m.lnSuccess < 1
             * failed
         ELSE
             IF c_Result.RecInserted <> 1
                 * failed or multiple seqno
                 SET STEP ON
             ENDIF
         ENDIF

     ENDIF

ENDSCAN



--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  multipart/related
    text/html
    image/jpeg
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to