Text Database Question/Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Artem Simonov

    Text Database Question/Problem

    I would appreciate any help, since I've already spend many hours searching
    for answers to my numerous questions. Here is what I want to do:

    In VB(6), I have 4 fields and I want to record them into a TEXT database, in
    the format of a table ("Blah", "blahblah, etc"). It seems easy enough, but
    for some reason I can't do it. I need to be able to write to this database
    and then read the entries from it (second part of my program). The reason
    that I want to use a plain TEXT database is because I will encrypt the data
    using my own complicated methods.

    Thanks in advanced for any suggestions
    Artem


  • Larry Serflaten

    #2
    Re: Text Database Question/Problem


    "Artem Simonov" <[email protected]> wrote
    [color=blue]
    > I would appreciate any help, since I've already spend many hours searching
    > for answers to my numerous questions. Here is what I want to do:
    >
    > In VB(6), I have 4 fields and I want to record them into a TEXT database,[/color]

    What are you calling a TEXT database?
    [color=blue]
    > in the format of a table ("Blah", "blahblah, etc").[/color]

    What is a table format?
    [color=blue]
    > It seems easy enough, but for some reason I can't do it.[/color]

    Why not? What have you tried?
    [color=blue]
    > I need to be able to write to this database
    > and then read the entries from it (second part of my program).[/color]

    It would not be worth doing if you could not do both operations....
    [color=blue]
    > The reason that I want to use a plain TEXT database is because
    > I will encrypt the data using my own complicated methods.[/color]

    If the file is encrypted, then it isn't plain text, is it?

    When you go to solve a problem, start by fully defining the problem.

    Only you know what you are looking for. To get help from others you
    will have to be a bit more descriptive to let them know what you want.
    Posting examples of the code you have already tried helps to understand
    what you are trying to do. Perhaps someone else can see what you are
    missing....

    LFS




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

    Comment

    • Roy Riddex

      #3
      Re: Text Database Question/Problem

      > I would appreciate any help, since I've already spend many hours searching[color=blue]
      > for answers to my numerous questions. Here is what I want to do:
      >
      > In VB(6), I have 4 fields and I want to record them into a TEXT database,[/color]
      in[color=blue]
      > the format of a table ("Blah", "blahblah, etc"). It seems easy enough, but
      > for some reason I can't do it. I need to be able to write to this database
      > and then read the entries from it (second part of my program). The reason
      > that I want to use a plain TEXT database is because I will encrypt the[/color]
      data[color=blue]
      > using my own complicated methods.
      >
      > Thanks in advanced for any suggestions
      > Artem
      >[/color]

      I have just completed a project at college which used a sequential (text)
      file to store information. Here is what you need:

      ' Start by declaring a Private Type (for your array)

      Private Type CustomerDetails
      Customer As String
      Address As String
      DeleteRecord As String
      End Type
      ' I actually found it easier to treat everything in the Private Type as a
      String, it gave me less errors to fix.

      Dim CustomerRecords As CustomerDetails * 50
      Dim CustomerFile As String
      Dim NoOfCustomers As Integer


      ' Load the file details into an array as follows:

      Private Sub Form_Load()
      CustomerFile = App.Path & "\Customer. txt"
      Open CustomerFile For Input As #1
      NoOfCustomers = 1
      Do While Not EOF(1)
      Input #1, CustomerRecords (NoOfCustomers) .Customer
      Input #1, CustomerRecords (NoOfCustomers) .Address
      CustomerRecords (NoOfCustomers) .DeleteRecord = "No" ' This can be
      changed to "Yes" later
      NoOfCustomers = NoOfCustomers + 1
      Loop
      Close #1
      End Sub


      ' Edit the array contents as follows:

      Private Sub cmdEdit_Click()
      Do
      EditCount = EditCount + 1
      Loop Until CustomerRecords (EditCount).Cus tomer = TextBox1.Text
      CustomerRecords (EditCount).Add ress = TextBox2.Text
      ' To delete a record you could do:
      CustomerRecords (EditCount).Del eteRecord = "Yes"
      End Sub


      ' Save the array contents back to file as follows:

      Private Sub cmdSave_Click()
      Dim SaveIndex As Integer
      SaveIndex = 1
      CustomerFile = App.Path & "\Customer. txt"
      Open CustomerFile For Output As #1
      Do While SaveIndex < NoOfCustomers
      If CustomerRecords (SaveIndex).Del eteRecord = "No" Then
      Write #1, CustomerRecords (SaveIndex).Cus tomer; _
      CustomerRecords (SaveIndex).Add ress
      End If
      SaveIndex = SaveIndex + 1
      Loop
      Close #1
      End Sub

      I found it beneficial to create a text file manually and at least enter 1
      set of details manually before trying to access it through my VB program.
      Enter it in the following format:
      "John Brown","122 Greenacres"


      Regards

      Roy


      Comment

      Working...