Re: RS.AddNew..What is wrong with this....

Results 1 to 2 of 2

Thread: Re: RS.AddNew..What is wrong with this....

  1. #1
    Join Date
    Dec 1969

    Default Re: RS.AddNew..What is wrong with this....

    I am trying to UPDATE records using rs.addnew/rs.update<BR>NOT trying to add new records. <BR><BR>I assume that by creating a RS that includes only one potential per field name, would be the key. am i correct?<BR><BR>I have gone through and through in my "set rs = " & lines, but never with the desired results... here is the latest version.<BR><BR>++++++++++++++++++++++++++++++++++ +++++++++++++++++++<BR>set rs = server.createobject("adodb.recordset")<BR>rs.lockt ype = adopenkeyset<BR>rs.locktype = adlockoptimistic<BR> "user where Username=&#039"&user&"&#039", db, , , adcmdtable<BR>++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++<BR><BR>The above works with out returning an error message, however when i check my records within the DB, i see that new rows were added, instead of updating the fields specified by my rs.update commands (listed here)<BR><BR>+++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++<BR>rs.addnew<BR>rs.fie lds(""&destination&"") = "demo add by george"<BR>rs.fields(""&destination&"mls") = "whatever" <BR>rs.fields(""&destination&"date") = "today"<BR>rs.fields(""&destination&"rate") = "5"<BR>rs.update <BR>++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++<BR><BR>I have done it with variables such as:<BR><BR>sql = "select * from user where Username=&#039"&user&"&#039"<BR><BR>when this is done, i get an error message saying "error with FROM clause"<BR><BR>This is the ONLY thing holding me from completeing this script!! ANYBODY?<BR><BR>Thanks in advance!<BR><BR>George<BR><BR>You can email directly if you would like:<BR><BR><BR>< BR>Thanks !!!

  2. #2
    Henning Guest

    Default RE: Re: RS.AddNew..What is wrong with this....

    Hi George, <BR><BR>rs.addnew is the command for adding a new record. If You just want to update an existing record, drop the addnew, just assign new values for the fields and after call the rs.update

Posting Permissions

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