Update a record with ADOTABLE
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Update a record with ADOTABLE

  1. #1
    Join Date
    Mar 2011
    Location
    Greece
    Posts
    26

    Update a record with ADOTABLE

    Goodmorning

    I have a simpe application with 2 tables in a database in access 2007

    If i use an ADOTable and i want not to post a new record but to change one that already exist. How i move to the row to change my record. for example i wrote that but its not right because no changes become

    ADOTable1->Active=true;
    ADOTable1->Edit();

    ADOTable1->FieldValues["CUSTOMER_WATERMETER"]=Edit3->Text;
    ADOTable1->FieldValues["CUSTOMER_NAMED"]=Edit4->Text;
    ADOTable1->FieldValues["CUSTOMER_SURNAMED"]=Edit5->Text;
    ADOTable1->FieldValues["CUSTOMER_FATHERD"]=Edit6->Text;
    ADOTable1->FieldValues["CUSTOMER_STATHEROD"]=Edit7->Text;
    ADOTable1->FieldValues["CUSTOMER_MOBILED"]=Edit8->Text;
    ADOTable1->FieldValues["CUSTOMER_AFMD"]=Edit9->Text;
    ADOTable1->FieldValues["CUSTOMER_ADDRESSD"]=Edit10->Text;
    ADOTable1->FieldValues["CUSTOMER_CITYD"]=Edit11->Text;
    ADOTable1->FieldValues["CUSTOMER_ZIPD"]=Edit12->Text;

    ADOTable1->Post();
    ADOTable1->Active=false;

    I am not sure if Edit is the right code to move on the row that i want to make the change. For example if i want a new one i would use Append and go to a new row. should i use an other component?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,610

    Re: Update a record with ADOTABLE

    Did you open the recorsdset before updating it?
    And, please, use Code tags while posting code snippets! See Announcement: Before you post....
    Victor Nijegorodov

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center