Inserting data from text file into database

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Inserting data from text file into database

    Is it possible to write a script in an ASP page that reads a comma delimited text file and inserts the data row by row into an Access db? Each comma delimit in the text file represents one field in the db table.
    Dan Guest

  2. Similar Questions and Discussions

    1. i want to display all the data in the database to the text field
      Well, I have 5 data in the database list(gDatabase), i want to display them all on the member("datafield").. when I used the repeat function, it...
    2. Inserting data from a form to an MS access database
      I'm new to coldfusion, and have run into a problem when trying to insert data from a basic HTML form into an MS Access database. The problem is...
    3. Trouble inserting data in database
      I use DW 2004, XP with sp2, and Access 2003. Im planning to make a site that is possible to log in and update news from the web. So I have made a...
    4. getting text file into database automatically
      mk, "TransferText" can either be a macro action or a VBA method. The place to begin your research would be to investigate TransferText. -...
    5. Importing a text file into a database
      Hi If you are sure that the imported field names (BRO_CODE1, BRO-CODE1, BROCH_CODE1, etc) are *exactly* the same as your table field...
  3. #2

    Default Re: Inserting data from text file into database

    Dan wrote:
    > Is it possible to write a script in an ASP page that reads a comma
    > delimited text file and inserts the data row by row into an Access
    > db? Each comma delimit in the text file represents one field in the
    > db table.
    Yes, but it's easier to use Access' built-in import functionality to do
    this.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows [MVP] Guest

  4. #3

    Default Re: Inserting data from text file into database

    <<
    Is it possible to write a script in an ASP page that reads a comma
    delimited text file and inserts the data row by row into an Access db?
    Each comma delimit in the text file represents one field in the db
    table.
    >>
    You can connect to a csv file (which can be opened in Excel and which an
    Excel file can be converted into) in good form just as you can to a
    regular database.

    The .csv file needs to be uploaded to the server.

    And you can have two recordsets open at the same time.

    So I'd suggest going through this recordset one row at a time and within
    this loop add a new record to the "real" database's recordset.

    And for help connecting to a text file using the Jet OLE DB provider:
    [url]http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#O[/url]
    LEDBProviderForMicrosoftJetText

    And based on the above link realize that the actual filename does NOT go
    in the connection string - rather it goes in the SQL statement
    (definitely a little tricky).

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    [url]http://www.Bullschmidt.com[/url]
    Classic ASP Design Tips, ASP Web Database Demo, ASP Bar Chart Tool...


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt Guest

  5. #4

    Default Re: Inserting data from text file into database

    Bullschmidt wrote ...
    > > Is it possible to write a script in an ASP page that reads a comma
    > > delimited text file and inserts the data row by row into an Access db?
    > You can connect to a csv file (which can be opened in Excel and which an
    > Excel file can be converted into) in good form just as you can to a
    > regular database.
    >
    > The .csv file needs to be uploaded to the server.
    >
    > And you can have two recordsets open at the same time.
    >
    > So I'd suggest going through this recordset one row at a time and within
    > this loop add a new record to the "real" database's recordset.
    Both a .csv file and a Jet database can be queried using the MS OLE DB
    Provider for Jet. Therefore, recordsets and looping should be
    avoidable and instead use an INSERT INTO..SELECT query to update the
    table in one hit e.g. while connected to the Jet DB:

    INSERT INTO
    MyJetTable
    (MyCol1, MyCol2)
    SELECT
    MyCol1, MyCol2
    FROM
    [Text;Database=C:\MyFolder\;].[MyFile#csv]
    ;

    Some fine tuning (column names, data types, etc) can be done on the
    csv file using a schema.ini file:

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/workingwithtextfiles.asp[/url]

    Jamie.

    --
    Jamie Collins Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139