Hi all,
I have two delete recordset queries:
<%
Set objrs = Server.CreateObject("ADODB.RecordSet")
SQLString = " Select * from Personnel " & _" WHERE Personnel.p_id = " & Request.Form("delete_staff")
objrs.open SQLString, objconn, 3, 3
objrs.delete
objrs.update
objrs.close
%>
<%
Set objrs = Server.CreateObject("ADODB.RecordSet")
SQLString = " Select * from specialists " & _" WHERE specialists.p_id = " & Request.Form("delete_staff")
objrs.open SQLString, objconn, 3, 3
if (objRS.BOF and objRS.EOF) then
Exit
Else
objrs.delete
End If
objrs.update
objrs.close
%>
I want to run the first one and then the second but if the second recordset does not exist then i want to just ignore it but still run the first one???
Thanx in advanceI'm not a big fan of using ADO to delete and update records, it kinda scares me a bit.
This is what I would do:
'objconn is your ADODB.CONNECTION
strSQL = "DELETE FROM Personnel WHERE p_id=" & Request.Form("delete_staff")
objconn.Execute(strSQL)
strSQL = "DELETE FROM specialists WHERE p_id=" & Request.Form("delete_staff")
objconn.Execute(strSQL)
This will run them regardless of whether they have records or not. If there are none for the query, it won't delete anything.great thanks, i'll give it a try.
I have two delete recordset queries:
<%
Set objrs = Server.CreateObject("ADODB.RecordSet")
SQLString = " Select * from Personnel " & _" WHERE Personnel.p_id = " & Request.Form("delete_staff")
objrs.open SQLString, objconn, 3, 3
objrs.delete
objrs.update
objrs.close
%>
<%
Set objrs = Server.CreateObject("ADODB.RecordSet")
SQLString = " Select * from specialists " & _" WHERE specialists.p_id = " & Request.Form("delete_staff")
objrs.open SQLString, objconn, 3, 3
if (objRS.BOF and objRS.EOF) then
Exit
Else
objrs.delete
End If
objrs.update
objrs.close
%>
I want to run the first one and then the second but if the second recordset does not exist then i want to just ignore it but still run the first one???
Thanx in advanceI'm not a big fan of using ADO to delete and update records, it kinda scares me a bit.
This is what I would do:
'objconn is your ADODB.CONNECTION
strSQL = "DELETE FROM Personnel WHERE p_id=" & Request.Form("delete_staff")
objconn.Execute(strSQL)
strSQL = "DELETE FROM specialists WHERE p_id=" & Request.Form("delete_staff")
objconn.Execute(strSQL)
This will run them regardless of whether they have records or not. If there are none for the query, it won't delete anything.great thanks, i'll give it a try.