Solved

Connecting CEdit to database field

Posted on 2001-08-01
4
174 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 94
Expand to include initial dialog with two choices. 9 66
Shell script to login to remote m/c and execute commands 10 78
no14 challenge 14 62
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…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

929 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now