Solved

Connecting CEdit to database field

Posted on 2001-08-01
4
201 Views
Last Modified: 2013-11-20
i have a CEdit control, i need  to add properties to this control to make it able to connect a database and bound it to specific table field ( just like bounding a text field to table filed from a Data control in Visual basic)
0
Comment
Question by:raqadi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:IainHere
ID: 6339542
Well derive a class from CEdit, give it a member variable which is a CRecordset (or similar), and a few member functions - one which accepts a connection string in SQL for instance.  Catch OnLoseFocus event and update the database/recordset with the altered text.  to It really depends on your needs.

Is there only going to be one edit control in your application that connects?  Give it a CDatabase.

Are there going to be lots of edits connecting to a database?  Give them each a recordset and connect them to a common CDatabase.

Are you only going to be viewing text, or will you need to handle booleans and integers and dates etc? You'll need some validation, or else you'll get lots of "update failed" notifications from the database, which wouldn't be best practice.

This is only the beginning.  You're asking a lot - perhaps you'd like to narrow it down a bit?
0
 

Author Comment

by:raqadi
ID: 6339768
Hi,
im not developing a new application, im developing an ActiveX control inhirited from CEdit, and i want my control to acts like the TextBox that exist in Visual basic according to any data control exist in the form.
0
 
LVL 2

Expert Comment

by:BogdyPtr
ID: 6442101
If your application connects to a database through a recordset you go to class wizzard , member variables tab and and map the recordset field to the edit box.
0
 

Accepted Solution

by:
raqadi2 earned 110 total points
ID: 6663124
try to go to the ClassWizard, go to the Text property, click Data Binding button, and make the property bindable. try the control after this modification, you will see that the needed properties added as needed.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question