hi.
i want to ask about updating and deleting records from database using recordset method instead of sql method. I using asp and flash.
am i correct to write like this for update?
struserID = Request("currentUserID")
strconID = Request("currentContactID")
strFname = Request("newFname")
strLname = Request("newLname")
strphone = Request("newphone")
stremail = Request("newemail")
straddress = Request("newaddress")
strfax = Request("newfax")
strcompany = Request("newcompany")
strnotes = Request("newnotes")
'create the database connection
Set oConn = Server.CreateObject("ADODB.Connection")
'open the database
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/0search001/database02.mdb")
'open the recordset
Set oRs = Server.CreateObject("ADODB.Recordset")
strSql = "Select * From Contacts Where UserID= " & struserID & " AND ContactID = "strconID" "
oRs.Open strSql,oConn,1,3
If oRs.EOF Then
Response.write ("updatego=false")
else
oRs("FirstName") = strFname
oRs("LastName") = strLname
oRs("PhoneNum") = strphone
oRs("Email") = stremail
oRs("Address") = straddress
oRs("FaxNum") = strfax
oRs("Company") = strcompany
oRs("Notes") = strnotes
oRs.Update
Response.write ("updatego=true")
end if
oRs.Close
oConn.Close
and this for delete?
strconid = Request("currentContactID")
strFname = Request("newFname")
strLname = Request("newLname")
struserID = Request("currentUserID")
'create the database connection
Set oConn = Server.CreateObject("ADODB.Connection")
'open the database
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/0calendar001/database02.mdb")
'open the recordset
Set oRs = Server.CreateObject("ADODB.Recordset")
strSql = "Select * From Contacts Where FirstName='"& strFname & "' " & " And LastName= '" & strLname & "' And UserID= " & struserID & " AND ContactID = "strconID" "
oRs.Open strSql,oConn,1,3
If oRs.EOF Then
Response.write ("deletego=false")
else
oRs.Delete
Response.write ("deletego=true")
end if
oRs.Close
oConn.Close
-