Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Update Event

Posted on by Microsoft Employee

I’m trying to update , delete or insert in the grid view

And everytime I try to insert data into the grid keep getting this error

 

I have the FieldName property for each text field to its corresponding field in the database

 

when i remove the update event from the code it still saves it is there something that i am missing ???

Thanks

 

Private Sub SafGrid1_LineChkEvent(ByRef Action As System.Int16, ByRef MaintFlg As System.Int16, ByRef RetVal As System.Int16) Handles SafGrid1.LineChkEvent

 

       Dim sqlstr As String

        Dim key As String

 

      

        Dim buffer As Byte() = Encryption(cNumber.CtlText, key)

        Dim EncryptedData As String = Convert.ToBase64String(buffer)

        sqlstr = "select * from xCreditCard where custid = " & SParm(cCustID.CtlText) & " AND cardnumber = " & SParm(EncryptedData)

        serr1 = SqlFetch1(CSR_Credit, sqlstr, bxCreditCard)

        If serr1 = NOTFOUND Then

            Found = False

            bxCreditCard = nxCreditCard

        Else

            Found = True

        End If

    End Sub

 

 

Private Sub Update1_UpdateEvent(ByVal Level As Short, ByVal InsertFlg As Short, ByVal LevelsDone As Short, ByVal LevelsLeft As Short, ByRef RetVal As Short) Handles Update1.UpdateEvent

        If Level = Finished Then

            Call TranBeg(True)

 

            Dim key As String

        

            Dim buffer As Byte() = Encryption(cNumber.CtlText, key)

            Dim EncryptedData As String = Convert.ToBase64String(buffer)

            bxCreditCard.cardNumber = EncryptedData

            If Found = True Then

                SUpdate1(CSR_Credit, "XCREDITCARD", bxCreditCard)

            Else

                bxCreditCard.custid = cCustID.CtlText

                bxCreditCard.cardAddress = cCardAddress.CtlText

                bxCreditCard.cardType = ccardtype.CtlText

                bxCreditCard.CVV = cCVV.CtlText

                bxCreditCard.ExpDate = cExpDate.CtlText

                bxCreditCard.name_card = cName.CtlText

                bxCreditCard.zipCode = cZipCode.CtlText

                SInsert1(CSR_Credit, "XCREDITCARD", bxCreditCard)

            End If

            Call TranEnd()

 

        End If

 

    End Sub

 

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update Event

    something similar to this can happen if the unique key on the table does not correspond the level property of the grid field or the field is a key field but does not have the k attribute specified in the level property.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans