| bill dubis 2004-08-05, 7:15 pm |
| I hope someone can catch something here I'm missing. The code executes
without errors but does not actually delete the record.
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/employee.asp" -->
<%
if(Request("UID") <> "") then cmdRemoveUsers__varUserID = Request("UID")
%>
<%
Dim delete_emp
Dim delete_emp_numRows
Set delete_emp = Server.CreateObject("ADODB.Recordset")
delete_emp.ActiveConnection = MM_employee_STRING
delete_emp.Source = "SELECT * FROM tblEmployee"
delete_emp.CursorType = 0
delete_emp.CursorLocation = 2
delete_emp.LockType = 1
delete_emp.Open()
delete_emp_numRows = 0
%>
<%
IF Request("Submitted") <> "" THEN
IF (Request("UID") <> "") THEN
set cmdRemoveUsers = Server.CreateObject("ADODB.Command")
cmdRemoveUsers.ActiveConnection = MM_employee_STRING
cmdRemoveUsers.CommandText = "DELETE FROM tblEmployee WHERE UID IN(" +
Replace(cmdRemoveUsers__varUserID, "'", "''") + ") "
cmdRemoveUsers.CommandType = 1
cmdRemoveUsers.CommandTimeout = 0
cmdRemoveUsers.Prepared = true
cmdRemoveUsers.Execute()
END IF
Response.Redirect("deleteemployee.asp")
END IF
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
delete_emp_numRows = delete_emp_numRows + Repeat1__numRows
%>
//Edited out html
<td><form action="directory.asp" method="post"
enctype="multipart/form-data" name="del_user" target="_parent">
<table width="200" border="1" align="center">
<%
While ((Repeat1__numRows <> 0) AND (NOT delete_emp.EOF))
%>
<tr bgcolor="<% If Repeat1__index Mod 2=0 Then
Response.Write("FBFBF6") Else Response.Write("F7F4E2") %>">
<td><input name="UID" type="checkbox"
value="<%=(delete_emp.Fields.Item("UID").Value)%>" ></td>
<td><%=(delete_emp.Fields.Item("FirstName").Value)%></td>
<td><%=(delete_emp.Fields.Item("LastName").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
delete_emp.MoveNext()
Wend
%>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input type="hidden" name="Submitted" value="True"></td>
<td><input name="Remove" type="submit" id="Remove" value="Remove
Selected Users" ></td>
<td> </td>
</tr>
</table>
</form></td>
//more html bye-bye
<%
delete_emp.Close()
Set delete_emp = Nothing
%>
|