CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    5

    Database connectivity

    Hi Guys,
    I have some problem in adding records to the database table(ODBC).
    After binding the controls to the recordset ,I dont know how to write the message handlers for add record.
    Could u please help me by giving an example .
    Thanks in advance

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: Database connectivity

    MFC ? no MFC ?
    What do you mean by message handlers for add record ?

  3. #3
    Join Date
    Oct 2005
    Posts
    5

    Question Re: Database connectivity

    Its MFC.I referred MSDN.I could bind the control variables to recordset.
    Then we need to write the implementation code in the respective handlers.
    Suppose I have a button add and when i click on add ,then the editbox contents shld be added to the table. This is where i'm struck.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Database connectivity

    If you're using ODBC, I assume you're using a CRecordset derived class. If you aren't, you should be. The basic procedure there is call AddNew(), assign values to the member variables, then call Update().

    As far as doing it in response to a button click, you'll need a message handler for your button. Again, assuming a CDialog derived class, use Class Wizard to assign a message handler for you.

  5. #5
    Join Date
    Dec 1999
    Location
    North Sydney, NS
    Posts
    445

    Re: Database connectivity

    Quote Originally Posted by poojanair
    Hi Guys,
    I have some problem in adding records to the database table(ODBC).
    After binding the controls to the recordset ,I dont know how to write the message handlers for add record.
    Could u please help me by giving an example .
    Thanks in advance
    For something like this I'll build an SQL statement in my button message handler then execute it with SQLExecute.
    I know how to build. What to build is a completely different story.

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