Results 1 to 5 of 5

Thread: Editing a .txt database

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    31

    Exclamation Editing a .txt database

    Hi all, I have a TXT database that has data in this formatt,

    Username,Password,Something,Somethign,Something,Something
    Username,Password,Something,Somethign,Something,Something
    Username,Password,Something,Somethign,Something,Something
    Username,Password,Something,Somethign,Something,Something

    I also have a small program that can read it and desplay the values in there apropriate txt boxes, Now the problem, Im a bit of a new gguy to VB, i want to be able to search the "Daatabase" And find a Username, And edit JUST the value specified or only the value changed, whilst keeping the rest same?

    I have had this in different threads, but i dont really understand how the code i got given was ment to be used, can someone post some code and explain it to me??
    THANKS in advance, NATHAN

  2. #2
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: Editing a .txt database

    HERE'S a project that i just wrote, it does everything you describe except where it finds a matching value, it doesn't write it to file (it does ask you for the new value though, and echos it at the end). I can make it write the new value to the end of the existing file, but i'm not sure how to make it edit the value in the middle, hopefully someone else can fill that bit in.

    I.E. if you have a value

    Name1, Pass1, val11, val21, val31, val41
    Name2, Pass2, val12, val22, val32, val42
    Name3, Pass3, val13, val23, val33, val43
    (as data)

    and you want to edit the second line, val32, for a new value "Me" I can write it so that the new data file is:

    Name1, Pass1, val11, val21, val31, val41
    Name2, Pass2, val12, val22, val32, val42
    Name3, Pass3, val13, val23, val33, val43
    Name2, Pass2, val12, val22, Me, val42

    If you like. Please let me know, and sorry I couldn't give a full answer ^_^

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    31

    Re: Editing a .txt database

    Thanks, i got that far, but because the database is a password login and the program that authenitcates the username and password searches through line by line and gets to the First matching value, when the username or password is changed the old value will still be there, thus it would find it first and not change a thing, unless it could delete the old line and just add the appended one to the end
    hope that makes sence
    Cheers Nathan

  4. #4
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: Editing a .txt database

    Yeah I know what you mean.. Been thinking of ways to do it, not 100% sure though >_< Sorry I couldn't help any more, i'm still a real noob at VB.. I never get a chance to and help anyone here because people's VB problems are usually way over my head ^^;

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    31

    Re: Editing a .txt database

    Thats fine, Im sure that i will find a way some time, or someone will reply to this by the morning, im a real VB n00b too, this is about my first real project that i have stuck to, i need to learn it for work, but being only 16 i cant really do a course on it...Hopefully someone here will be able to help me out....
    Thanks,
    Nathan

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