Improve company productivity with a Business Account.Sign Up


need help urgently

Posted on 1998-09-10
Medium Priority
Last Modified: 2013-11-20
My project is going to due soon....about a week or two from now..and this is what happened...after I got extension from the due date.
I have done my projects but unfortunately, I saved them in 2 files.
One is my project for image processing where I need to extract some
features out. And I have done that part. I am able to show the values out
in a messagebox.
Also, I did another project, for my database where I am suppose
to store those values I extracted out. Currently, in my database, I got
those values from access only.
How should I interact both of them together? Meaning I want to calculate the values
using the first file and store them automatically in the second file(database)
when I, let say click a menu item called STORE?
Question by:kean082198
  • 3
  • 3
  • 3

Expert Comment

ID: 1322048
Is this for a school assignment?   assuming it's not,
simply have to:

1) open your file,
2) extract the data
3) Open a connection to your db (perhaps odbc)
4) Open the table
5) Add a record
6) close the table
7) close the connection to the db


Expert Comment

ID: 1322049
8) close your input data file

Author Comment

ID: 1322050
Dear Duneram,
No it is not my assignment, it is my project. So basically these are the steps I need to do:
1. Open the file - the file where I calculate the 4 values, let say a, b, c, d. OK that is simple.
2. Extract the data - yup, the 4 values are extracted…got them as a, b, c, d and is able to display those values out when I click display on the menu bar.
3. Open a connection to the db - I don't know how to do this part. What commands should I write and where should I do it. Which part of the function
4. Open the table - I don't understand
5. Add a record - yup, I understand this, but how?
6. Close the table - what is the command
7. Close the connection to the db - no idea how?
8. Close your input data file - please help…

Please, sir I really need help here. Please show me the step by step source codes to achieve this thing. Desperately need help. Thank you.


Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 1322051
Dear experts,
Please help...

Expert Comment

ID: 1322052
Hi Kean,
You can derive a class from CRecordset, let's call it CMySet. While doing this, you can point (in the wizard) to a table or a sql-query and classmembers are automatically created for you (for example m_ID, m_Name, etc).
In your app, you create a database connection with CDatabase.

CDatabase mydb;

Then you can use CMySet.Open to open the table you need. After that you can say:

You can close the dataconnection and the recordset with their Close()-methods.


Expert Comment

ID: 1322053
Sounds like the answer to me...

Accepted Solution

MelissaC earned 140 total points
ID: 1322054
See text above??

Author Comment

ID: 1322055
Dear Melissa,
I still don't understand what you wrote there. I am a very weak Visual C++ programmer and I need your help to tell me the step by step to do the project. What you have written are still very vague to me.
Please help.

Expert Comment

ID: 1322056
1. Deriving a class from CRecordset:
In Classwizard, click on "Add Class". You can choose between making a new class or creating a class that is a child of another (already existing) class (= a derivation class). Choose to make a class of an existing class, class CRecordset. Call it MyRecordset.
The classwizard lets you point to a table or a sql query in a database. In fact, it lets you point to a DSN (Data Source Name, you can make a DSN, which is in fact a pointer to a database, by clicking Start-Settings-Control Pannel-32bitODBC in windows).

The new class that you created with the classwizard will contain member variables, and the function DoFieldExchange. Whenever you open the recordset with the function MySet.Open(), the data from the table will be read into those member variables. You can scroll through the table by using functions like:
MySet.MoveFirst(), MySet.MoveLast(), MySet.MoveNext, etc.

2. Adding new records

CMySet.AddNew();        //create space to insert new record
     CMySet.m_ID=11;    //store value 11 in member variable m_ID of                         //MySet
                        //Store value "MelissaC" in member var.
CMySet.Update();        //Store the new values in the database
                //(in fact, the function DoFieldExchange is called)

You can close the dataconnection and the recordset with their Close()-methods.
Hope this explanation will get you on the right track!
Good Luck!

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

606 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