Database Integration

J

Jon Barker

Hi,

i have set up a website as a GUI for a database, well almost have. I have
got everything to how i want except i am unable to find out how to edit an
existing record. I do not wish to use the database interface wizard if i can
help it. if anyone could help it would be appreciated, thanks.

Jon
 
M

MD WebsUnlimited.com

Hi Jon,

Why not the DIW?

The code to accomplish would be to read the record in then use the Update
verb of the ADO to update the database.
Sample code:
case "Update"
'fUpdate
r = "Select * FROM Resellers where resellers.resellerID='" &
request.form("Reseller") & "'"
rs.close
set rs = Nothing
set rs = server.CreateObject("ADODB.Recordset")
if IsObject(rs) then
rs.open r,cn,2,2
end if
if NOT rs.EOF then
sErr_Msg = "Record Updated"
rs("ResellerID") = request.form("reseller")
rs("Password") = request.form("password")
rs("Address1") = request.form("Address1")
rs("Address 2") = request.form("Address2")
rs("Display Name") = request.form("DisplayName")
rs("First Name") = request.form("FirstName")
rs("Middle Name") = request.form("MiddleName")
rs("Last Name") = request.form("LastName")
rs("Postfix") = request.form("Postfix")
rs("Organization") = request.form("Organization")
rs("Title") = request.form("Title")
rs("City") = request.form("City")
rs("State") = request.form("State")
rs("Country") = request.form("Country")
rs("Postal Code") = request.form("zip")
rs("Phone") = request.form("Phone")
rs("Fax") = request.form("Fax")
rs("Email") = request.form("Email")
rs("Opt-in") = false
if request.form("Opt_in") = "True" then rs("Opt-in") = true
rs("WebSiteURL") = request.form("WebSite")
rs("PayableTo") = request.form("PayableTo")
rs("LastUpdateDate") = Date()
rs.update
rs.close
 
Top