Insert .. or AddNew()...

Results 1 to 5 of 5

Thread: Insert .. or AddNew()...

  1. #1
    mythili Guest

    Default Insert .. or AddNew()...

    Which is the better way of inserting records into the database?<BR>With recordSet.AddNew() & update the values<BR>OR <BR>conn.execute("Insert into table ..")<BR><BR>If it is, what are the advantages of using the better one and what are the disadvantages of the latter one?<BR><BR>thanks in advance.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Insert .. or AddNew()...

    Using the SQL commands (ie. INSERT INTO...) will increase performance across your site. I personally would recommend SQL commands for scalability. Even if your not familiar with SQL you could use MS Access or Visual Interdev to generate your SQL scripts. They&#039re great tool for learning.<BR><BR>Hope this helps!

  3. #3
    Steve Nicholls Guest

    Default Depends....

    My opinion is that either method is equally valid, with each having pros and cons.<BR><BR>In my experience using the AddNew method is usually slower unless writing to an Access database in which case performance can be significantly faster. With other flavours of database SQL, Oracle etc an INSERT query is usually the better option. Therefore for a scaleable solution INSERT is probably the better choice.<BR><BR>In my opinion the main disadvantage with the latter option is the additional coding required to ensure that the special literal characters (pipes, quotes etc) are correctly handled and that dates are inserted in the correct format.<BR><BR>In conclusion I would recommend using AddNew if you only ever intend to have an Access back end or if performance is not a major issue. In all other cases use INSERT queries but remember to add checks for special literal characters.<BR><BR>regards, Steve<BR><BR><BR><BR>

  4. #4
    mythili Guest

    Default thanks..

    Thanks for giving help on that..<BR>I am using "Insert into " and having lot of problem with quotes.<BR>I am checking for "&#039" but not " " ". I dont know how to avoid both of them.<BR><BR>anyway thanx<BR><BR>mtyhs

  5. #5
    BS Guest

    Default RE: thanks..

    U could use this function before the String variable in the insert statement<BR>&#060;%<BR>&#039Function to replace single quotes with double quotes<BR>Function ReplaceQuotes(str)<BR> ReplaceQuotes=replace(str,"&#039","&#039&#039")<BR >End Function<BR>%&#062;

Posting Permissions

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