Solved

need help urgently

Posted on 1998-09-10
9
154 Views
Last Modified: 2013-11-20
DearExperts,
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?
0
Comment
Question by:kean082198
  • 3
  • 3
  • 3
9 Comments
 
LVL 2

Expert Comment

by:duneram
Comment Utility
Is this for a school assignment?   assuming it's not,
you
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

0
 
LVL 2

Expert Comment

by:duneram
Comment Utility
8) close your input data file
0
 

Author Comment

by:kean082198
Comment Utility
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.

Kean

0
 

Author Comment

by:kean082198
Comment Utility
Dear experts,
Please help...
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Expert Comment

by:MelissaC
Comment Utility
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;
mydb.Open("ODBC-connectstring,...)

Then you can use CMySet.Open to open the table you need. After that you can say:
CMySet.AddNew();
  CMySet.m_ID=11;
  CMySet.m_Name="MelissaC"
CMySet.Update();

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




0
 
LVL 2

Expert Comment

by:duneram
Comment Utility
Sounds like the answer to me...
0
 
LVL 2

Accepted Solution

by:
MelissaC earned 70 total points
Comment Utility
See text above??
0
 

Author Comment

by:kean082198
Comment Utility
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.
0
 
LVL 2

Expert Comment

by:MelissaC
Comment Utility
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
     CMySet.m_Name="MelissaC"
                        //Store value "MelissaC" in member var.
                        //m_Name
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!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

12 Experts available now in Live!

Get 1:1 Help Now