Results 1 to 5 of 5

Thread: Get Flat File Data

  1. #1

    Thread Starter
    Hyperactive Member kleptos's Avatar
    Join Date
    Aug 2001
    Location
    The Dark Carnival
    Posts
    346

    Get Flat File Data

    I have a text file
    Code:
        1000|COL1|COL2|COL3|COL4|COL5|COL6|1
        1001|COL1|COL2|COL3|COL4|COL5|COL6|0
        1002|COL1|COL2|COL3|COL4|COL5|COL6|1
    and i want to load ALL records and display COL1 in a ListBox (This i am able to do). Once i do that i want to be able to click on an element in the ListBox, go to that text file, get the other values (COL2, COL3, ETC) populate a few text boxes that all relate to that record (1000) in the textfile (Here is where i am lost). I also want to be able to update just that row (1000) with new data from the text boxes. For deleteing a row, i want to change the last character from a 1 (Active) to a 0 (Inactive).

    Any help would be appreciated.
    ..::[kleptos]::..
    • Database Administrator (MSSQL 2000)
    • Application Developer (C#)
    • Web Developer (ASP.NET)


  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    put an stringtable that is filled up with arrays with each one of the values (the columns)..then just access the string table by the name(1000, 1001 etc..)
    \m/\m/

  3. #3

    Thread Starter
    Hyperactive Member kleptos's Avatar
    Join Date
    Aug 2001
    Location
    The Dark Carnival
    Posts
    346
    How would i save the file? Save the whole string table back to the file? Or is there another way?
    ..::[kleptos]::..
    • Database Administrator (MSSQL 2000)
    • Application Developer (C#)
    • Web Developer (ASP.NET)


  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Is COL1 unique?

    I'll assume it's not. In that case you need a struct that stores all columns and a bool active flag. Then you add a hashtable wich matches the ID to those structs. Then you add the ID as user data to the rows of the list box. When the user clicks an entry you get the ID, look up the corresponding struct and write its values into the edits.

    For writing out you get the keys from the hashtable, sort them and loop through them, writing each entry to a new line in the file.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Hyperactive Member kleptos's Avatar
    Join Date
    Aug 2001
    Location
    The Dark Carnival
    Posts
    346
    No, COL1 isn't unique, the first field 1000 is going to be the unique item per row.

    Thanks for the help, i will try that as soon as i get a chance.
    ..::[kleptos]::..
    • Database Administrator (MSSQL 2000)
    • Application Developer (C#)
    • Web Developer (ASP.NET)


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