Efficient way to bulk-insert posted form records?

Results 1 to 2 of 2

Thread: Efficient way to bulk-insert posted form records?

  1. #1
    Join Date
    Dec 1969

    Default Efficient way to bulk-insert posted form records?

    Hi everyone,<BR><BR>I have an asp page, which creates an HTML form for a client to fill out and submit. <BR><BR>The form itself can have quite a few (50 at most) rows which need filling out. Each row represents a record to be inserted into a SQL table. <BR><BR>Right now, when the form is submitted, one of my VB 6 components reads the form variables (they&#039;re sequentially numbered) and performs individual inserts into the SQL table, one row at a time. <BR><BR>This works well enough, although I&#039;d like to try batching up all the form information (maybe into a standalone recordset) and running a bulk-insert of some sort. The idea is to cut down on the number of component calls, maybe save time that way. <BR><BR>Has anyone tried this before, and if so, can you point me in the right direction? Would a recordset BatchUpdate maybe do the trick here?

  2. #2
    Join Date
    Dec 1969

    Default How does using a standalone RS...

    ...cut down the number of component calls???<BR><BR>Granted, you might not be hitting the DB as much, but the number of "component" calls will actually go up just a tad, no?<BR><BR>Anyway, adding 50 records or so doesn&#039;t seem very excessive to me. How often is this done? Even little old Access should be able to easily do that in under 10 seconds. So unless you have many people doing this at the same time--say over a couple of hundred additions of 50 records every hour?--I&#039;m not sure it&#039;s worth finding a better way.<BR><BR>Of course, you *could* simply put all the data into text format and then write it out as a ".csv" file. Then you could treat the ".csv" file as a database (yes, the JET drives can handle it easily) and do a one-SQL-statement query that would copy all the stuff from the ".csv" to the main DB.<BR><BR>Without thinking too hard about it, that seems reasonably efficient to me: You can build up the entire file contents in memory, as a string, and then write it to the actual file in one statement. Then set up your connection and carefully specify the .csv file as an external DB and you&#039;re done.<BR><BR>

Posting Permissions

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