CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2000
    Posts
    264

    Converting a text file to a database

    I hope someone could give me a sense of direction on this one. I have a text file that is tab delimited and I need to read this text file and put each item I read into a database. I also need to know what kind of format the VB app that I am writing should be in? ActiveX exe? Regular exe? etc as the VB program will run behind the scenes, so there will be no interface for it.

    I will be using SQL Server as my database tool and I am using VB6 to write my code. Any help would be greatly appreciated!



  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Converting a text file to a database

    I would NOT write a VB app.
    use the SQL Server tools to load your file, e.g. the bulk copy program (BCP) or DTS if you sqlserver is version 7 and above.


  3. #3
    Join Date
    Jan 2000
    Posts
    264

    Re: Converting a text file to a database

    Thanks, that sounds what I'm looking for but I'm not familiar with SQL Server all that much. I currently have a VB app that is already running and I was just going to make this new function a part of it. Since this app is running all the time, it will look for these text files every 5 minutes and put them in the database. Can VB call a SQL Server function to do this?

    Sorry for making this long winded. P.S. I currently have 6.5 but I will have Ver 7.


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: Converting a text file to a database

    several solutions:
    - use VB's Shell command to start the BCP-Utility
    - use SQLDMO Komponent to programmatically invoke a BulkCopy process
    - use ADO (activex Data objects) to connect to the database and do your inserts via the ADO object model (involves the most work).


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