ceeleelewis
Programmer
I have a subroutine that I am trying to use to delete, edit, & add requests ( in this case delete) based off the reqFormID (request form id). It seems like I have a problem with the record set object or strSQL statment. When I comment out the strSQL out,then replace it with objRS.open "CMCNTRreq", objConn, adOpenStatic, adLockOptimistic.. I get
a response but the problem is it only list the first record on the database.
I even change the obRS.open "CMCNTRreq", objConn, adOpenStatic,
adLockOptimistic to obRS.open "CMCNTRreq", objConn, adOpenDynamic,
adLockOptimistic and end up with the same record showing.
What am I doing wrong? Your direction will be helpful.
Below is the subroutine...thx
C. Lewis
'===========================================================
' Subroutine - Delete Record
'===========================================================
Sub subDeleteRecord
Dim i, intFieldCount
'Define SQL Query
strSQL = "SELECT * FROM [CMCNTRreq] WHERE [reqFormId]="
&Request.Querystring("Delete"
'Response.Write "OOOH YEAAH!!!"
'Open recordset passing the SQL to the connection object.
'objRS.open "CMCNTRreq", objConn, adOpenStatic, adLockOptimistic
objRS.Open "CMCNTRreq", strSQL, objConn, 1, 3
'Check for errors in objConn
subErrorCheck
intFieldCount = objRS.Fields.Count
%>
<%
If Request.Querystring("Confirmed" = 1 Then
'Delete record:
objRS.Delete
'Check for errors in objConn
subErrorCheck
%>
<p align="center">Record #<%= Request.Querystring("Delete" %>
has been deleted.</p>
<p align="center"><a href="commandopenreqmngr.asp">Return to
Command Center Open Request List</a></p>
<%
Else
'Confirm delete prompt:
%>
<p align="center">Are you sure you wish to delete the following
request?</p>
<table width="80%" align="center" cellspacing="0"
cellpadding="3" border="1">
<tr>
<% For i = 0 To intFieldCount -1 %>
<th><%= objRS(i).Name %></th>
<% Next %>
</tr>
<tr>
<% For i = 0 To intFieldCount -1 %>
<td><%= objRS(i)%></td>
<% Next %>
</tr>
</table>
<p align="center">
<a href="commandopenreqmngr.asp?Delete=<%=
Request.Querystring("Delete" %>&Confirmed=1">Yes</a> |
<a href="commandopenreqmngr.asp">No</a>
</p>
<%
End If
End Sub
%>
<%
a response but the problem is it only list the first record on the database.
I even change the obRS.open "CMCNTRreq", objConn, adOpenStatic,
adLockOptimistic to obRS.open "CMCNTRreq", objConn, adOpenDynamic,
adLockOptimistic and end up with the same record showing.
What am I doing wrong? Your direction will be helpful.
Below is the subroutine...thx
C. Lewis
'===========================================================
' Subroutine - Delete Record
'===========================================================
Sub subDeleteRecord
Dim i, intFieldCount
'Define SQL Query
strSQL = "SELECT * FROM [CMCNTRreq] WHERE [reqFormId]="
&Request.Querystring("Delete"
'Response.Write "OOOH YEAAH!!!"
'Open recordset passing the SQL to the connection object.
'objRS.open "CMCNTRreq", objConn, adOpenStatic, adLockOptimistic
objRS.Open "CMCNTRreq", strSQL, objConn, 1, 3
'Check for errors in objConn
subErrorCheck
intFieldCount = objRS.Fields.Count
%>
<%
If Request.Querystring("Confirmed" = 1 Then
'Delete record:
objRS.Delete
'Check for errors in objConn
subErrorCheck
%>
<p align="center">Record #<%= Request.Querystring("Delete" %>
has been deleted.</p>
<p align="center"><a href="commandopenreqmngr.asp">Return to
Command Center Open Request List</a></p>
<%
Else
'Confirm delete prompt:
%>
<p align="center">Are you sure you wish to delete the following
request?</p>
<table width="80%" align="center" cellspacing="0"
cellpadding="3" border="1">
<tr>
<% For i = 0 To intFieldCount -1 %>
<th><%= objRS(i).Name %></th>
<% Next %>
</tr>
<tr>
<% For i = 0 To intFieldCount -1 %>
<td><%= objRS(i)%></td>
<% Next %>
</tr>
</table>
<p align="center">
<a href="commandopenreqmngr.asp?Delete=<%=
Request.Querystring("Delete" %>&Confirmed=1">Yes</a> |
<a href="commandopenreqmngr.asp">No</a>
</p>
<%
End If
End Sub
%>
<%