Need a little help please. I've got the below to add records to a
table, but I need to learn how to do updates and deletes.
Could someone give me examples of how to update and delete a record
based on the below?
For update, I'd like an example on how to update the Location based on
frm_cname. For delete, I'd like to see an example of how to delete
the row based on frm_cname.
Thanks!!
===============================
<%
Dim objCommand
Dim objRec
Set objCommand = Server.CreateObject ("ADODB.Command")
Set objRec = Server.CreateObject ("ADODB.Recordset")
strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=d:\www
\signup.mdb"
objRec.Open "tablename", strConnect, 3, 3, 2
objRec.AddNew
objRec("TIME") = Now()
objRec("LOCATION") = Request.Form("frm_loc")
objRec("CLIENT") = Request.Form("frm_cname")
objRec.Update
objRec.Close
Set objRec = Nothing
Set objCommand = Nothing
%>
John Blessing - 06 Mar 2007 14:35 GMT
> Need a little help please. I've got the below to add records to a
> table, but I need to learn how to do updates and deletes.
[quoted text clipped - 31 lines]
> Set objCommand = Nothing
> %>
Aircode, might need a bit of fixing up but you should get the general idea
set objconn = server.create ("adodb.connection")
...
objconn.open strconnect
objconn.execute ("delete from table where recordid=" & cstr(yourid)
...
objconn.execute ("update yourtable set column=" & yourval & " where
recordid=" & cstr(yourid)
or
objconn.execute ("update yourtable set column='" & yourcharval & "' where
recordid=" & cstr(yourid)
or
objrec.Open "Select col from yourtable where recordid=" & cstr(yourid),
objconn
objrec.fields("col") = yournewval
objrec.update
....