?
Solved

Connecting CEdit to database field

Posted on 2001-08-01
4
Medium Priority
?
204 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 440 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

800 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