Solved

need help urgently

Posted on 1998-09-10
9
160 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
[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
  • 3
  • 3
  • 3
9 Comments
 
LVL 2

Expert Comment

by:duneram
ID: 1322048
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
ID: 1322049
8) close your input data file
0
 

Author Comment

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

Kean

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kean082198
ID: 1322051
Dear experts,
Please help...
0
 
LVL 2

Expert Comment

by:MelissaC
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;
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
ID: 1322053
Sounds like the answer to me...
0
 
LVL 2

Accepted Solution

by:
MelissaC earned 70 total points
ID: 1322054
See text above??
0
 

Author Comment

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

Expert Comment

by:MelissaC
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
     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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sameEnds challenge 3 187
zeroMAx challenge 20 127
How to convert MFC::CString to UTF8 wchar_t* 10 388
Authenticate using sesu from script 7 118
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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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