CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2011
    Posts
    3

    File comparison and database update basics

    I am new to Visual C++ windows form application development. I am doing a task where I need some serious help regarding the coding or even can guide me some references. I have made forms and added all the necessary controls.

    tasks:

    I have an input file (*.txt) and a database (*.txt).

    for eg:##

    input file:

    ##########
    Hi this is my input file
    #############
    List of students
    ############

    Leonard
    Age:32

    Sheldon Cooper
    Age:45

    Leonard
    Place:New Jersey

    Sheldon Cooper
    Place: New York

    ###############
    This is the end of the file


    eg for Database:

    Leonard
    Age:30

    Raj K
    Age:22

    Leonard
    Place:Toronto

    Raj K
    Place: Delhi

    ########



    So what I need to do here is to edit this input file automatically and insert the correct 'Age' and 'Place' of the students as given in the database.

    If a student is not present in the database. Pop up a window and show the list of students with the parameters 'Age' and 'Place' so that I can edit it from there. Once I edit it, these new students have to be added to the Database in the same format as the others with the edited value of parameters.

    So,

    #What sort of search should I have to do to find the 'name' match between the input and that in the database?

    # Someone could provide me a sample example somewhat related to it?

    It would be of real help. I use Visual C++ 2010 Express for this task.

    Regards
    Last edited by Lemontree45; August 9th, 2011 at 03:42 AM.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: File comparison and database update basics

    If you're using forms, I assume you're using .net which makes this the wrong forum.

    To a programmer, a database typically isn't a text file.

    If it were me, I'd load the "database" into a map, or two maps for age and location using the name as the key.

    Read the input file, parse out the name, look it up in your maps, get the appropriate value and write the file back out.

    I'd recommend working through a good tutorial if you're not sure how to do that stuff. A detailed explanation is beyond the scope of a forum.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured