In my database program, I need a control that list records in the recordset, it can move next, previous, first and end, and it can add new, delete and modify record, Who knows is there such a control, Thanks!
Printable View
In my database program, I need a control that list records in the recordset, it can move next, previous, first and end, and it can add new, delete and modify record, Who knows is there such a control, Thanks!
I don't know if there's a control, but look at CRecordView.
Seems like it would be pretty trivial to do it with a dialog too.
Is there such an Activex control ? Thanks!
How could such a control exist? It would have to know what the name and properties of your fields ahead of time!!!
There are some activex grid controls that would list your fields for you given an sql statement.
And you can use SQL to ADD, DELETE, UPDATE.
... there might be a control that returns the text value of fields given an SQL statement, then you can use Cwnd::SetWindowText and place the value in Edit controls.
No matter what, you still have to do some programing, there is no control that you give a table and after placing it in a dialog box it creates all the functionality that you are asking for.
Like I said, using SQL is you best bet, however getting the field values into text format can be a little messy unless you find a control to do it for you: You can write it yourself, but it's a little work, it won't kill you, but it will be a little time consuming the first time.
With SQL you can ask this kind of stuff from the database... to be honest.. it is not that hard to make a activex control that does what forester wants.Quote:
How could such a control exist? It would have to know what the name and properties of your fields ahead of time!!!
Thank you for your replies!
If I try to use ActiveX grid controls, what are the most powerful ActiveX controls, where can I get them?
If there are add new, delete and modify buttons on the ActiveX control, that's better, then I only need to run the corresponding add new, delete and update SQL command, no need to process the user interface matters such as adding button and icon resoures, or adding a new row in the list or grid etc. The Microsoft datagrid control version 6.0 provided in VC6 has no such buttons, there are only move next, previous, first and end buttons on it.
If there is such an ActiveX control, it will save a lot of time in database program developing. Thanks!
Well, CFormView is more of a problem than a solution. I tried using it at first and it has a ton of problems. Memo fields are limited to the amount of text they can pass unless you go in and hack the code.
CFormView doesn't work in dialog boxes, so if you want to edit a Database in a dialog box your out of luck. When you want to work with more than One Table or Database in a form/dialog box, CFormView is even more of a hassle.
I'm talking about using CRecordSet, CDaoRecordset or ado in a diaog box with sql access methods.
CFormview is ok if you just want to work with One Table of a database, and even then it's very limited.
Well if the control executes a SQL statement then that's all you need.
I don't have MSDN in front of me, but there is a command something like CRecordset::Execute which will run a SQL command on a DATABSE, it only takes about 4 lines of code to open the database, execute the sql and close the data base.
4 Lines of Code in a member function and 3 sql statements for a Adding, Deleting, Updating should do the trick. ... or find a ActiveX control that executes a sql statement on a given database: ... or just write you own.
DataGrid and what I just said above should do the trick.