web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Saving to a custom table receiveds error Programming Bulletproof Error 10262

(0) ShareShare
ReportReport
Posted on by

I've added a custom table to the Dynamics SL AR Invoice and Memo screen and it displays, updates but does not insert new records. When the screen inserts a new ARDoc row, I receive the following:

Programming Bulletproof Error 10262

Invalid cursor value passed to sinsert1(). Please make sure cursor value is greater than 0. Also verify that this cursor has been passed to sql().

I did the work around of performing a select to initialize the cursor to get a non-zero value for the cursor but then it seems the cursor becomes SqlReadOnly (per the following error) instead of the SqlList flag that it was created.

System Message 10091

Cursor specified SqlReadOnly flag.

Function: sinsert(DefaultCreated)

Level: NOLEVEL

Tables(s): xMSOTCARDoc

Sql: Select * from xMSOTCARDoc where BatNbr = '007797' and RefNbr = '001896'

Should I do a work around to do an Update statement instead of a Select or what is the real way to keep the cursor initialized to allow updates, inserts and selects?

Dynamics SL 2011 FP1

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Apps Mexico Profile Picture
    1,090 on at

    Try this, just replace SoshipHeadAd to xMSOTCARDoc:

    Private Sub Form1_Load()

       Call SetAddr(NOLEVEL, "bSoshipHeadDAd", bSoshipHeadDAd, nSoshipHeadDAd, LenB(bSoshipHeadDAd))

       Call SqlCursor(CSR_SoshipHeadDAd, NOLEVEL)

    End Sub

    Private Sub Update1_OnUpdate(Level As Integer, InsertFlg As Integer, retval As Integer)

    serr2 = SqlFetch1(CSR_SoshipHeadDAd, "xSPSoshipHeadDAd_All" & SParm(sShipperID) & SParm("%"), tSoshipHeadDAd, LenB(tSoshipHeadDAd))

                           If serr2 = NOTFOUND Then

                               Call SInsert1(CSR_SoshipHeadDAd, "SoshipHeadDAd", bSoshipHeadDAd, LenB(bSoshipHeadDAd))

                           End If

    End Sub

  • Community Member Profile Picture
    on at

    I'll try those variations.

    I had used SqlCursorEx instead of SlCursor.

    I see that you are using a temporary structure tSoshipHeadDAd for the fetch.

  • Verified answer
    Community Member Profile Picture
    on at

    Turns out that in previous versions of SL, I've used SlCursorEx with NOLEVEL + SqlUpdate or other additions. Seems to work well in SL 2011 with just  NOLEVEL.

    Call SqlCursorEx(csrxMSOTCARDoc, NOLEVEL, "csrxMSOTCARDoc", "xMSOTCARDoc", "xMSOTCARDoc")

  • Apps Mexico Profile Picture
    1,090 on at

    Yes, actually the sqlcursorex is the best way for aditional tables, the key of the solution is the SqlFetch1 that is before SInsert or SUpdate, that allows to the kernel know about the what is the row that have to insert or update. The t structure is to avoid lose all the data that is stored on the buffer (b structure).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans