in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

DBNAVIGATOR AND ADDNEW

Last post 07-15-2008 4:28 PM by C1_GregL. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-05-2008 8:30 PM

    DBNAVIGATOR AND ADDNEW

    Hello,

    I am testing C1 products to see if we can use them in our programs.

    I try to use C1dbnavigator with truedbgrid with nwind.mdb and customer table.(C1expressconnection and C1expresstable)

    First I press the add button and a new row is added at the end of the grid. (that is ok)

    Then I put a value in customerid that already exists to test unicity of the primary key. (I also put a value in companyname which can not be null).

    When i try to move to another row, a messagebox indicates that this key already exists,( thats ok)

    But then i can move to other rows and my newly added row is still there with

    My question, How can i do for not allow the user to go to another row until he introduces correct values, or he can cancel the adding of the new row, but then the newly added row should be deleted.

    I joined form1, (nwind.mdb is in the componentone directory)

    can someone give me some hints and have a look at my sample.

    Thanks. 

     

  • 07-15-2008 4:28 PM In reply to

    • C1_GregL
    • Top 10 Contributor
    • Joined on 06-11-2007
    • Pittsburgh PA
    • Posts 500

    Re: DBNAVIGATOR AND ADDNEW

    The error you receive, "Column 'CustomerID' is constrained to be unique.  Value 'xxx' is already present", comes from the C1ExpressConnection.  When an error with C1ExpressConnection occurs its Error event gets raised, in which you can capture this specific event and delete the newly added row.

    1. Private Sub C1ExpressConnection1_Error(ByVal sender As System.Object, ByVal e As C1.Data.DataSetEventArgs) Handles C1ExpressConnection1.Error
    2.    C1TrueDBGrid1.MoveLast()
    3.    C1TrueDBGrid1.Delete()
    4. End Sub

    Regards,
    Greg L

Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.