ceeleelewis
Programmer
Hello,
I have an Edit subroutine that I want to Update my table information when I submit this form. When I had this form just dynamically showing me the fields that I wanted to update, everything ran smoothly. Now that I want to display the fields in my form, I'm getting a nasty bug saying that two of my fields are empty.... when I do a response.write(objRS("RequesterName"), I can see that there is data in the field so my questions are...
Is there a reason why the command response.write(Request.Form("RequesterName") is not returning any thing?
Also, should I be creating a read for update string using SQL?
As always, any direction is greatly appreciated....
see code below..
'==================================================================================================
' Subroutine - Edit Record
'==================================================================================================
Sub subEditRecord
'Dim i, intFieldCount
'Define SQL Query& Request.Querystring("Edit"cmdCntrgrp, Status, reqFormId
strSQL = "SELECT cmdCntrgrp, RequesterId, RequesterName, ManagerName, RequesterEmail, ManagersEmail, RequesterPhone, ManagersPhone, DeptName, BusinessUnit, SysAdmin, MakeModel, OtherMakeModel, ServerLoc, OtherServLocation, ServType, IPAdd, OSType, OtherOSType, OSVersion, AppsMon, NumCPU, BusReason, Status, DetailDescript, ProjectNumber, CAR,reqFormId FROM [CMCNTRreq] WHERE [reqFormId]='" & Request.Querystring("Edit" & "'"
'Open recordset passing the SQL to the connection object.
'Open as Static to be able to execute more Move commands in the recordset.
objRS.open strSQL, objConn, adOpenDynamic, adLockOptimistic
'Check for errors in objConn
subErrorCheck
'intFieldCount = objRS.Fields.Count
If Request.Form("Update" = 1 Then
response.write(Request.Form("RequesterName")
'If Request.Form("RequesterName" = "" Then' or Request.Form("RequesterId" = ""
If Not IsEmpty(Request.Form)Then
'If Request.Form("RequesterName" = "" Then
%>
<p align="Center">
<font color="#FF0000">Error.</font><br><br> Requester Name(RequesterName) and Requester Id fields cannot be blank.<br><br>
<a href='#1' onClick='history.back()'>Back</a>
</p>
<%
Else
'Update the database
'objRS("reqFormId" = Trim(Request.Form("reqFormId")
'objRS("reqDate" = Trim(Request.Form("reqDate")
'objRS("RequesterId" = Trim(Request.Form("RequesterId")
objRS("RequesterName" = (Request.Form("RequesterName")
objRS("ManagerName" =(Request.Form("ManagerName")
objRS("RequesterEmail" = Trim(Request.Form("RequesterEmail")
objRS("RequesterPhone" = Trim(Request.Form("RequesterPhone")
objRS("ManagersPhone" = Trim(Request.Form("ManagersPhone")
objRS("DeptName" = Trim(Request.Form("DeptName")
objRS("BusinessUnit" = Trim(Request.Form("BusinessUnit")
objRS("SysAdmin" = Trim(Request.Form("SysAdmin")
objRS("MakeModel" = Trim(Request.Form("MakeModel")
objRS("OtherMakeModel" = Trim(Request.Form("OtherMakeModel")
objRS("ServerLoc" = Trim(Request.Form("ServerLoc")
objRS("OtherServLocation" = Trim(Request.Form("OtherServLocation")
objRS("ServType" = Trim(Request.Form("ServType")
objRS("IPAdd" = Trim(Request.Form("IPAdd")
objRS("OSType" = Trim(Request.Form("OSType")
objRS("OtherOSType" = Trim(Request.Form("OtherOSType")
objRS("OSVersion" = Trim(Request.Form("OSVersion")
objRS("AppsMon" = Trim(Request.Form("AppsMon")
objRS("NumCPU" = Trim(Request.Form("NumCPU")
objRS("BusReason" = Trim(Request.Form("BusReason")
objRS("Status" = Trim(Request.Form("Status")
objRS("cmdCntrgrp" = Trim(Request.Form("cmdCntrgrp")
objRS("DetailDescript" = Trim(Request.Form("DetailDescript")
If Trim(Request.Form("cmdCntrgrp") = "" Then
objRS("cmdCntrgrp" = Replace("cmdCntrgrp"," ","n/a"
Else
objRS("cmdCntrgrp" = Trim(Request.Form("cmdCntrgrp")
End If
objRS.Update
'Check for errors in objConn
subErrorCheck
%>
<p align="Center">
Your update has been processed succesfully.<br><br>
<a href="commandopenreqmngr.asp">Return to Open Requests</a>
</p>
<%
End If
Else
%>
<form method="post" action="commandopenreqmngr.asp?Edit=<%= Request.Querystring("Edit" %>">
<table width="70%" align="center" cellspacing="0" cellpadding="3" border="0">
<tr>
<td align="center" colspan="6"><font size="3"> <strong> Please edit the information below</strong></font></td>
</tr>
<tr>
<td width="20%"><font color="#FF0000" size="2"><b> Requester Name:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("RequesterName"%>" /> </td>
<td width="25%" align="right"><font color="#FF0000" size="2"><b> Requester Phone:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("RequesterPhone"%>" /> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="2" align="right" ><font color="#FF0000" size="2"><b>Requester Email:</b></font></td>
<td align="center" ><input type="text" value="<%= objRS("RequesterEmail"%>" /> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td width="20%"><font color="#FF0000" size="2"><b> Manager's Name:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ManagerName"%>" /> </td>
<td width="25%" align="right"><font color="#FF0000" size="2"><b>Manager's Phone:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ManagersPhone"%>" /> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="2" align="right"><font color="#FF0000" size="2"><b>Manager's Email:</b></font></td>
<td align="center"><input type="text" value="<%= objRS("ManagersEmail"%>" /> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b> Department Name:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("DeptName"%>" /> </td>
<td width="25%"><font size="2"><b>Business Unit:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("BusinessUnit"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Project Number:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ProjectNumber"%>" /> </td>
<td width="25%"><font size="2"><b>C.A.R.:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("CAR"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Current Status:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("Status"%>" /> </td>
<td width="25%"><font size="2"><b>Assign To:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("cmdCntrgrp"%>" />
</tr>
<tr>
<td><font size="2"><b>Business Reason:</b></font></td>
<td colspan="3"><textarea name="Business Reason" cols="10" rows="3"><%= objRS("BusReason" %></textarea></td> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Make and Model:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("MakeModel"%>" /> </td>
<td width="25%"><font size="2"><b>Other Make and Model:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OtherMakeModel"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Sever Location:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ServerLoc"%>" /> </td>
<td width="25%"><font size="2"><b>Other Server Location:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OtherServLocation"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Type Of Server:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ServType"%>" /> </td>
<td width="25%"><font size="2"><b>IP Address:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("IPAdd"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Type Of OS:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OSType"%>" /> </td>
<td width="25%"><font size="2"><b>Other Type Of OS:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OtherOSType"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Version Of OS:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OSVersion"%>" /> </td>
<td width="25%"><font size="2"><b>Applications To Monitor/Report:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("AppsMon"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Number Of CPUs:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("NumCPU"%>" /> </td>
<td width="20%"><font size="2"><b> </b></font></td>
<td width="15%"> </td>
</tr>
</tr>
</table>
<table width="70%" align="center" cellspacing="0" cellpadding="3" border="0">
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td><font size="2"><b>Command Center Log:</b></font></td>
<td colspan="2"><textarea name="Any Other Requster Descriptions" cols="35" rows="5"><%= objRS("DetailDescript" %></textarea></td>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td><font size="2"><b>Requester Descriptions:</b></font></td>
<td colspan="2"><textarea name="Any Other Requster Descriptions" cols="35" rows="5"><%= objRS("DetailDescript" %></textarea></td>
</tr>
</tr>
<tr>
<td colspan="6" align="center">
<a href='#1' onClick='history.back()'>Back</a>
</td>
</tr>
<tr>
<td colspan="6" align="center">
<input type="hidden" name="Update" value="1">
<input type="submit" value="submit">
</td>
</tr>
</table>
</form>
<%
End If
End Sub
%>
I have an Edit subroutine that I want to Update my table information when I submit this form. When I had this form just dynamically showing me the fields that I wanted to update, everything ran smoothly. Now that I want to display the fields in my form, I'm getting a nasty bug saying that two of my fields are empty.... when I do a response.write(objRS("RequesterName"), I can see that there is data in the field so my questions are...
Is there a reason why the command response.write(Request.Form("RequesterName") is not returning any thing?
Also, should I be creating a read for update string using SQL?
As always, any direction is greatly appreciated....
see code below..
'==================================================================================================
' Subroutine - Edit Record
'==================================================================================================
Sub subEditRecord
'Dim i, intFieldCount
'Define SQL Query& Request.Querystring("Edit"cmdCntrgrp, Status, reqFormId
strSQL = "SELECT cmdCntrgrp, RequesterId, RequesterName, ManagerName, RequesterEmail, ManagersEmail, RequesterPhone, ManagersPhone, DeptName, BusinessUnit, SysAdmin, MakeModel, OtherMakeModel, ServerLoc, OtherServLocation, ServType, IPAdd, OSType, OtherOSType, OSVersion, AppsMon, NumCPU, BusReason, Status, DetailDescript, ProjectNumber, CAR,reqFormId FROM [CMCNTRreq] WHERE [reqFormId]='" & Request.Querystring("Edit" & "'"
'Open recordset passing the SQL to the connection object.
'Open as Static to be able to execute more Move commands in the recordset.
objRS.open strSQL, objConn, adOpenDynamic, adLockOptimistic
'Check for errors in objConn
subErrorCheck
'intFieldCount = objRS.Fields.Count
If Request.Form("Update" = 1 Then
response.write(Request.Form("RequesterName")
'If Request.Form("RequesterName" = "" Then' or Request.Form("RequesterId" = ""
If Not IsEmpty(Request.Form)Then
'If Request.Form("RequesterName" = "" Then
%>
<p align="Center">
<font color="#FF0000">Error.</font><br><br> Requester Name(RequesterName) and Requester Id fields cannot be blank.<br><br>
<a href='#1' onClick='history.back()'>Back</a>
</p>
<%
Else
'Update the database
'objRS("reqFormId" = Trim(Request.Form("reqFormId")
'objRS("reqDate" = Trim(Request.Form("reqDate")
'objRS("RequesterId" = Trim(Request.Form("RequesterId")
objRS("RequesterName" = (Request.Form("RequesterName")
objRS("ManagerName" =(Request.Form("ManagerName")
objRS("RequesterEmail" = Trim(Request.Form("RequesterEmail")
objRS("RequesterPhone" = Trim(Request.Form("RequesterPhone")
objRS("ManagersPhone" = Trim(Request.Form("ManagersPhone")
objRS("DeptName" = Trim(Request.Form("DeptName")
objRS("BusinessUnit" = Trim(Request.Form("BusinessUnit")
objRS("SysAdmin" = Trim(Request.Form("SysAdmin")
objRS("MakeModel" = Trim(Request.Form("MakeModel")
objRS("OtherMakeModel" = Trim(Request.Form("OtherMakeModel")
objRS("ServerLoc" = Trim(Request.Form("ServerLoc")
objRS("OtherServLocation" = Trim(Request.Form("OtherServLocation")
objRS("ServType" = Trim(Request.Form("ServType")
objRS("IPAdd" = Trim(Request.Form("IPAdd")
objRS("OSType" = Trim(Request.Form("OSType")
objRS("OtherOSType" = Trim(Request.Form("OtherOSType")
objRS("OSVersion" = Trim(Request.Form("OSVersion")
objRS("AppsMon" = Trim(Request.Form("AppsMon")
objRS("NumCPU" = Trim(Request.Form("NumCPU")
objRS("BusReason" = Trim(Request.Form("BusReason")
objRS("Status" = Trim(Request.Form("Status")
objRS("cmdCntrgrp" = Trim(Request.Form("cmdCntrgrp")
objRS("DetailDescript" = Trim(Request.Form("DetailDescript")
If Trim(Request.Form("cmdCntrgrp") = "" Then
objRS("cmdCntrgrp" = Replace("cmdCntrgrp"," ","n/a"
Else
objRS("cmdCntrgrp" = Trim(Request.Form("cmdCntrgrp")
End If
objRS.Update
'Check for errors in objConn
subErrorCheck
%>
<p align="Center">
Your update has been processed succesfully.<br><br>
<a href="commandopenreqmngr.asp">Return to Open Requests</a>
</p>
<%
End If
Else
%>
<form method="post" action="commandopenreqmngr.asp?Edit=<%= Request.Querystring("Edit" %>">
<table width="70%" align="center" cellspacing="0" cellpadding="3" border="0">
<tr>
<td align="center" colspan="6"><font size="3"> <strong> Please edit the information below</strong></font></td>
</tr>
<tr>
<td width="20%"><font color="#FF0000" size="2"><b> Requester Name:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("RequesterName"%>" /> </td>
<td width="25%" align="right"><font color="#FF0000" size="2"><b> Requester Phone:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("RequesterPhone"%>" /> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="2" align="right" ><font color="#FF0000" size="2"><b>Requester Email:</b></font></td>
<td align="center" ><input type="text" value="<%= objRS("RequesterEmail"%>" /> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td width="20%"><font color="#FF0000" size="2"><b> Manager's Name:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ManagerName"%>" /> </td>
<td width="25%" align="right"><font color="#FF0000" size="2"><b>Manager's Phone:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ManagersPhone"%>" /> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="2" align="right"><font color="#FF0000" size="2"><b>Manager's Email:</b></font></td>
<td align="center"><input type="text" value="<%= objRS("ManagersEmail"%>" /> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b> Department Name:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("DeptName"%>" /> </td>
<td width="25%"><font size="2"><b>Business Unit:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("BusinessUnit"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Project Number:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ProjectNumber"%>" /> </td>
<td width="25%"><font size="2"><b>C.A.R.:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("CAR"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Current Status:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("Status"%>" /> </td>
<td width="25%"><font size="2"><b>Assign To:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("cmdCntrgrp"%>" />
</tr>
<tr>
<td><font size="2"><b>Business Reason:</b></font></td>
<td colspan="3"><textarea name="Business Reason" cols="10" rows="3"><%= objRS("BusReason" %></textarea></td> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Make and Model:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("MakeModel"%>" /> </td>
<td width="25%"><font size="2"><b>Other Make and Model:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OtherMakeModel"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Sever Location:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ServerLoc"%>" /> </td>
<td width="25%"><font size="2"><b>Other Server Location:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OtherServLocation"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Type Of Server:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("ServType"%>" /> </td>
<td width="25%"><font size="2"><b>IP Address:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("IPAdd"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Type Of OS:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OSType"%>" /> </td>
<td width="25%"><font size="2"><b>Other Type Of OS:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OtherOSType"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Version Of OS:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("OSVersion"%>" /> </td>
<td width="25%"><font size="2"><b>Applications To Monitor/Report:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("AppsMon"%>" /> </td>
</tr>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td width="20%"><font size="2"><b>Number Of CPUs:</b></font></td>
<td width="15%"><input type="text" value="<%= objRS("NumCPU"%>" /> </td>
<td width="20%"><font size="2"><b> </b></font></td>
<td width="15%"> </td>
</tr>
</tr>
</table>
<table width="70%" align="center" cellspacing="0" cellpadding="3" border="0">
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td><font size="2"><b>Command Center Log:</b></font></td>
<td colspan="2"><textarea name="Any Other Requster Descriptions" cols="35" rows="5"><%= objRS("DetailDescript" %></textarea></td>
<tr bordercolorlight="#FFFFFF" bgcolor="#c0c0c0">
<td><font size="2"><b>Requester Descriptions:</b></font></td>
<td colspan="2"><textarea name="Any Other Requster Descriptions" cols="35" rows="5"><%= objRS("DetailDescript" %></textarea></td>
</tr>
</tr>
<tr>
<td colspan="6" align="center">
<a href='#1' onClick='history.back()'>Back</a>
</td>
</tr>
<tr>
<td colspan="6" align="center">
<input type="hidden" name="Update" value="1">
<input type="submit" value="submit">
</td>
</tr>
</table>
</form>
<%
End If
End Sub
%>