Results 1 to 7 of 7

Thread: database question

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    3

    database question

    The databasa is a .txt file and I need to get it working in a vb.net application. Is there a simple solution?

    Thank you in advance!

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: database question

    Welcome to the forums.

    "Get it working" means what?

    What do you need to do with your text file, precisely and specifically?

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    3

    Re: database question

    Thanks for the reply!
    First of all I said wrong, It's not a .txt file, its a .dbc which may look similar to this:
    -------
    NS_ :
    NS_DESC_
    CM_
    BA_DEF_
    BA_
    VAL_
    CAT_DEF_
    CAT_
    FILTER
    BA_DEF_DEF_
    EV_DATA_
    ENVVAR_DATA_
    SGTYPE_
    SGTYPE_VAL_
    BA_DEF_SGTYPE_
    BA_SGTYPE_
    SIG_TYPE_REF_
    VAL_TABLE_
    SIG_GROUP_
    SIG_VALTYPE_
    SIGTYPE_VALTYPE_

    BS_:

    BU_:


    BO_ 100 Scratch_n_sniff: 2 Vector__XXX
    SG_ Temp1 : 0|4@1+ (1,0) [-10|10] "C" Vector__XXX
    SG_ Temp2 : 4|4@1+ (1,0) [-10|10] "C" Vector__XXX
    SG_ varvtal : 8|8@1+ (1,0) [0|0] "" Vector__XXX


    CM_ BO_ 100 "Module which has 2 signals";
    CM_ SG_ 100 Temp1 "Tempsignal1";
    CM_ SG_ 100 Temp2 "Tempsignal2";
    ---------

    What I need to make is an application which can read and write to this .dbc file.

    All help is appreciated!

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: database question

    Before we can do anything, we need to be able to connect to it.

    What is a dbc file? What kind of format? How does it get created in the first place?

    Outside of a program, how would you open it?

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    3

    Re: database question

    the .dbc file is created by a similar program I'm trying to make. If you open it in notepad it looks like what I posted above. I guess it doesn't necessarily need to be a .dbc-file, but it would still be nice if I got something together that was able to read the old .dbc-files.

    To me it simply looks like a regular .txt-file saved as .dbc

  6. #6
    Member
    Join Date
    Dec 2005
    Posts
    63

    Re: database question

    If it's just an ASCII text file with a different extension, you should be able to use System.IO.StreamWriter and System.IO.StreamReader to write to and read from(respectively) the file.



  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: database question

    Quote Originally Posted by MarkDorf
    If it's just an ASCII text file with a different extension, you should be able to use System.IO.StreamWriter and System.IO.StreamReader to write to and read from(respectively) the file.
    Mark is correct.

    When I copied what you posted into Notepad, and I saved it as Hack.dbc, the file description that showed up in Explorer said "Microsoft Visual Foxpro Database Container"

    When I double click on it, it wants to open the file using Foxpro.

    However, when I ran this code
    VB Code:
    1. 'I can write to it the same
    2. 'way I write to a standard text file
    3. Private Sub Command3_Click()
    4. Dim sData As String
    5. Dim sFilename As String
    6. sFilename = "d:\hack.dbc"
    7.  
    8. Open sFilename For Append As #1
    9. Print #1, "Hack Rules"
    10. Close #1
    11.  
    12. End Sub
    13.  
    14. 'I can open it and load it into a listbox the same way I can any standard
    15. 'text file
    16. Private Sub Command2_Click()
    17. Dim sData As String
    18. Dim sFilename As String
    19. sFilename = "d:\hack.dbc"
    20.  
    21. Open sFilename For Input As #1
    22. While Not EOF(1)
    23.     Line Input #1, sData
    24.     List1.AddItem sData
    25. Wend
    26. Close #1
    27.  
    28. End Sub
    So, it would appear as though the OS thinks it is a Foxpro file, but your VB.NET program code should be able to manipulate it like any standard text file.

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