adding, updating, deleting, viewing: sql or obj?

Results 1 to 2 of 2

Thread: adding, updating, deleting, viewing: sql or obj?

  1. #1
    Join Date
    Dec 1969

    Default adding, updating, deleting, viewing: sql or obj?

    I am trying to do a basic script that lets people to add a review, delete a review, and update a review.<BR><BR>I am referring to ...<BR><BR>In it, RecordSet.Update and RecordSet.Delete is used<BR><BR>previously, I would always do and SQL statement, like SQL ADD (asdf,asdf) VALUES (&#039asdf&#039,&#039asdf&#039), while this article opens a connection, does recordset.addnew recordset.fields("asdf") = "asdf" recordset.update<BR><BR>which is better/why? [For me processing time is very important]<BR><BR><BR>also, requery is used when updating records, but not when adding. Any reason?<BR><BR>Final question. I have a db table holding about 300-500 records (memo, a few text). When displaying a record, should I open the entire recordset and use a loop to display the right one, or use WHERE ID="ID" when opening rs connection?<BR><BR>thanks

  2. #2
    SPG Guest

    Default RE: adding, updating, deleting, viewing: sql or ob

    1) Use native SQL ("insert into") syntax. It means that you&#039re not having to build and use an additional RecordSet object (ouch!) with an editing cursor (ouch!) while quite possibly scanning through said recordset (ouch!) and changing multiple values on an update (ouch!) when instead you could send a single command through your connection object and be done with it (ahhh.) There&#039s some processing time saved, but mostly (afaik) it saves memory (which may in turn save processing time, I never ran the numbers...).<BR><BR>2) Don&#039t know, I don&#039t requery. Maybe I&#039m evil that way, but I also don&#039t update records in the middle of a selection.<BR><BR>3) Use the Where. If you open the whole recordset, you&#039re allocating system resources to getting completely freakin&#039 worthless information from the database which you have to loop through one at a time. Bad developer! Don&#039t do work for yourself; make the database do it for you. That&#039s why a lot of people put a lot of effort into writing the SQL language in the first place...<BR><BR>HiH

Posting Permissions

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