Set db = CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
db.Open "DSN=name"
rs.CursorLocation = 3
rs.Open "SELECT * FROM Table WHERE Field="&Variable, db, 3, 3
if rs.EOF then
rs.AddNew
end if
rs("fieldName1") = Variable1
rs("fieldName2") = Variable2
rs("fieldName3") = Variable3
rs.Update
rs.Close
if SELECT returns nothing, add a record. after adding the cursor to the added record. if SELECT returns a record (because the field is unique), the cursor is on the selected record.
and then updates the record the cursor is in :)
source
share