Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Apr 2008
    Gender
    Male
    Posts
    351

    Default How to Import txt file to MSAccess or SQL Server using VB6.0?


    Kinsa kabalo ani mga boss? Newbie pman ko sa programming. Gusto nko import ang txt file padulong sa database(Access or SQLserver) using vb6. mao ni sulod sa textfile:

    test.txt:

    SEQ A ID B C TDATE T-TIME
    00001 1 00000001 1 0 2012/08/22 08:10
    00002 1 00000002 1 0 2012/09/22 07:51
    00003 1 00000003 1 0 2012/08/22 08:00
    00004 1 00000004 1 0 2012/10/22 07:58
    00005 1 00000005 1 0 2012/08/22 08:00
    00006 1 00000001 1 0 2012/08/22 12:01
    00007 1 00000002 1 0 2012/09/22 12:13
    00008 1 00000003 1 0 2012/08/22 12:14
    00009 1 00000004 1 0 2012/10/22 12:05
    00010 1 00000005 1 0 2012/08/22 12:00
    00011 1 00000001 1 0 2012/08/22 12:30
    00012 1 00000002 1 0 2012/09/22 12:22
    00013 1 00000003 1 0 2012/08/22 12:40
    00014 1 00000004 1 0 2012/10/22 13:00
    00015 1 00000005 1 0 2012/08/22 13:30
    00016 1 00000001 1 0 2012/08/22 18:01
    00017 1 00000002 1 0 2012/09/22 17:58
    00018 1 00000003 1 0 2012/08/22 18:10
    00019 1 00000004 1 0 2012/10/22 18:00
    00020 1 00000005 1 0 2012/08/22 18:03

    nya mao ni dapat ang output sulod sa database

    tblTest:
    ID PNAME DEPARTMENT TDATE IN1 OUT1 IN2 OUT2
    00000001 Mabini, Apolinario LOGISTICS 2012/08/22 08:10 12:01 12:30 18:01
    00000002 Bonifacio, Andress ACCOUNTING 2012/09/22 07:51 12:13 12:22 17:58
    00000003 Rizal, Jose MARKETING 2012/08/22 08:00 12:14 12:40 18:10
    00000004 Macapagal, Arroyo SALES 2012/10/22 07:58 12:05 13:00 18:00
    00000005 Aquino, Ninoy PURCHASING 2012/08/22 08:00 12:00 13:30 18:03

    Gusto nko ma distribute ang time T-Time ngadto sa database according to ID and TDate...Slamat daan mga boss.

  2. #2

    Default Re: How to Import txt file to MSAccess or SQL Server using VB6.0?

    ambot unsaun lang ni sa VB6 bro.. but this is just an idea bro, and pwede ni sa tanan language with file read and array.

    1 line should be 1 data entry.

    like

    firstname, stealthghost, lastname, gwapo, id, 2, anotherdata, 3
    firstname, marber, lastname, gwapo pud, id, 3, anotherdata, mydata ... and so on

    or you can put end marker to every data block..

    fname, stealthghost
    lastname, gwapo
    id, 2
    anotherdata, 3
    ! <- end of data block
    fname, marber
    lastname, gwapo pud
    id, 3
    anotherdata, mydata
    ! <- end of data block

    these two techniques have different logic in programming, but same lang og result..
    btw, as much as possible wala'y "Comma" or any other character ang gamitun..

    I've been using this technique with different characters like, # ! $ on java language...

    I think mao tawag ani nga techniques..
    Comma-separated values - Wikipedia, the free encyclopedia

    pero katong mga expert sa VB6, basin naa ma-suggest.. just sharing some ideas..
    lami kaayu mag programming balik, daghan ko gi-busyhan lain man gud..

  3. #3
    Junior Member
    Join Date
    Apr 2008
    Gender
    Male
    Posts
    351

    Default Re: How to Import txt file to MSAccess or SQL Server using VB6.0?

    mao man gud ni nga txt file format(TabDelimited) ako sundon bro kay mao mani ang output sa among system nya gusto nko ni import sa database. slamat sa input bro!

  4. #4

    Default Re: How to Import txt file to MSAccess or SQL Server using VB6.0?

    Quote Originally Posted by marber View Post
    mao man gud ni nga txt file format(TabDelimited) ako sundon bro kay mao mani ang output sa among system nya gusto nko ni import sa database. slamat sa input bro!
    kung ingon ana sa imung example ang data, and consistent siya,
    pwede ra pud ang SPACE ang imung separator..

    SEQ - A - ID - B - C - TDATE - T-TIME

    unya iphun nalang nimo, like in an array..

    array[0] = SEQ data
    array[1] = A data
    array[2] = ID data
    and so on and so forth..

    I hope it helps bro while waiting sa mga expert sa VB ngari..

  5. #5

    Default Re: How to Import txt file to MSAccess or SQL Server using VB6.0?

    unsa nga version ang sql server/access imu ge gamit?

  6. #6
    Junior Member
    Join Date
    Apr 2008
    Gender
    Male
    Posts
    351

    Default Re: How to Import txt file to MSAccess or SQL Server using VB6.0?

    SQL server 2000 / access 2003 boss

  7. #7
    Elite Member
    Join Date
    May 2011
    Gender
    Male
    Posts
    1,465

    Default Re: How to Import txt file to MSAccess or SQL Server using VB6.0?

    i.sud nag array bro. 2D ba or unsa. nya ikaw nabahala pasud sa imo db

    example.
    -----[0]--[1]-----[2]--[3][4]---[5]------[6]
    [0] 00001 1 00000001 1 0 2012/08/22 08:10
    [1] 00002 1 00000002 1 0 2012/09/22 07:51
    [2] 00003 1 00000003 1 0 2012/08/22 08:00
    [3] 00004 1 00000004 1 0 2012/10/22 07:58
    Last edited by jairoh_; 11-17-2012 at 09:36 AM.

  8.    Advertisement

Similar Threads

 
  1. How to Import Excel file to SQL using VB6.0?
    By killersmiles in forum Programming
    Replies: 9
    Last Post: 03-15-2012, 08:10 PM
  2. HELP: how to open .pdb file on mac? or convert .pdb to .pdf?
    By achibaby in forum Computer Hardware
    Replies: 1
    Last Post: 02-07-2010, 11:18 AM
  3. Replies: 6
    Last Post: 01-09-2008, 01:28 PM
  4. how to convert ogg files to avi ??
    By zerk in forum Software & Games (Old)
    Replies: 7
    Last Post: 03-31-2007, 03:27 PM
  5. How to add mp3 file to Motorola V3i via USB.. please help
    By jdimpas in forum Gizmos & Gadgets (Old)
    Replies: 8
    Last Post: 01-30-2007, 08:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top