Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Saving to a custom table receiveds error Programming Bulletproof Error 10262

Posted on by Microsoft Employee

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

  • Apps Mexico Profile Picture
    Apps Mexico 1,090 on at
    RE: Saving to a custom table receiveds error Programming Bulletproof Error 10262

    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).

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Saving to a custom table receiveds error Programming Bulletproof Error 10262

    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")

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Saving to a custom table receiveds error Programming Bulletproof Error 10262

    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
    Apps Mexico Profile Picture
    Apps Mexico 1,090 on at
    RE: Saving to a custom table receiveds error Programming Bulletproof Error 10262

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans