home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,479 of 10,840   
   Steve Gerrard to Jack   
   Re: Design question   
   08 May 05 10:54:36   
   
   From: mynamehere@comcast.net   
      
   "Jack"  wrote in message news:H5efe.3199$EC6.3128@trndny06...   
   > Hello,   
   > Here are the two scenarios.   
   > -1-   
   > For each record I need to insert into the db, Call a method on a class,   
   > passing the items.  In the method, execute an insert statement.   
   >   
   > -or-   
   > -2-   
   > Have a method, like 'additem'.  This method would add the stuff to a   
   > collection in the class.  Then, when the asp page is finished adding all its   
   > items, call a method to take each item in the collection and insert it to the   
   > database.   
   >   
   > I have done it both ways in the past, but was curious to know the way you   
   guys   
   > do something like this.  Thanks for your time.   
   >   
      
   It sounds to me like you end up with one insert statement per item either way.   
   In scenario 1, you pass one item, and it gets inserted.   
   In scenario 2, the items you pass are collected, and then each one gets   
   inserted.   
      
   The second approach is more flexible. If you called its AddItem method just   
   once, and then called its DoInserts method, you would get the result of the   
   first approach. So setting it up that way lets you have it both ways, and you   
   can use whichever works best in each situation.   
      
   With the second approach, you could also create a procedure in the database   
   that   
   would accept an array of data and do the multiple inserts directly in the   
   database.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca