Updating records/creating a new record

Results 1 to 3 of 3

Thread: Updating records/creating a new record

  1. #1
    timbo Guest

    Default Updating records/creating a new record

    how would I go about selecting a record that exists in my SQL database, updating it, then inserting it back into the same database? (I am trying to create a new record, using some of the previous record&#039s fields while updating others)

  2. #2
    peterjl@austec.net.au Guest

    Default RE: Updating records/creating a new record

    The code has the basics for update a database record based on some lookup index. You would need to replace f1,f2,f3 with the names of the fields you want to update, and updatevalue1-3 with update values, which would most likely come from form inputs. If you don&#039t know the connection string for accessing your database then you would need to ask your system admin.<BR>&#060;%<BR>set conn=server.createobject("adodb.connection")<BR>co nn.open "Your Connection String"<BR>set rs=server.createobject("adodb.recordset")<BR>Query ="Select * from YourTable where YourIndexField = " & IndexValue<BR>rs.open Query,Conn,3,3,1<BR>rs("f1")=updatevalue1<BR>rs("f 2")=updatevalue2<BR>rs("f3")=updatevalue3<BR>rs.up date<BR>rs.close<BR>set rs=nothing<BR>conn.close<BR>set conn=nothing<BR>%&#062;

  3. #3
    Join Date
    Dec 1969

    Default RE: Updating records/creating a new record

    pull the information you need using a select statement. <BR><BR>re-insert it using an insert statement.<BR><BR>however, if you need to do this, i&#039d say your database design really needs looking at. relational databases are designed to minimise replication of data in this way. point your browser to www.aspin.com and look up tutorials on relational databasing, or just visit the asp/database tutorial on www.webmonkey.com<BR><BR>jason

Posting Permissions

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