CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: The Logic

  1. #1
    Join Date
    Feb 2009
    Posts
    192

    The Logic

    Hi,

    I have 2 databases A and B;

    Now, in database 'A' I extract data for fields Name, Age and Status and display on a datagridview - bounded data.

    Then I have unbounded field called 'Enabled' which is a checkbox.

    So my Datagridview is like;

    Name Age Status Enabled
    John 35 Active Yes
    James 20 Active Yes
    Sarah 65 Old No
    Yo 53 On Hold No
    Julie 70 Active No


    Now, this is where it gets interesting - Columns - Name, Age and Status comes from database A and cant be changed/updated - am more interested in the last column "Enabled" which should be saved to a table with the rest of the fields (Name, Age, Status) to database B.

    A user can ONLY change the Enabled Flag to Yes/No in the datagridview, all other fields are READONLY.

    Now what logic can I perform -

    - To have a table in Database B with upto to date data of all the names and there current status + either enabled/disabled.


    Thanks

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: The Logic

    There should be some sort of Primary key here, in both tables. This would make it easier to link these two tables' relationship with one another. Once that is in place, updating the second table from table a would be a breeze

  3. #3
    Join Date
    Aug 2009
    Location
    NW USA
    Posts
    173

    Re: The Logic

    Clear the rows in B. Loop through the rows in A and add the appropriate information to new rows in B. I assume Enabled already exists in B, set it to 0. In your DGV have the fields all read only except for Enabled. Make sure you BS.EndEdit and TA.Update to B so your changes are saved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured