Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit not passing values to SQL DB on submit

Status
Not open for further replies.

sugermama

Technical User
Oct 19, 2001
11
US
I am stumped. I can't seem to figure out why the values are not being passed (except MACOM) upon submit. If anyone has a moment to look at my code and possibly assist, I would be greatly appreciative. I am sure I am making some boneheaded mistake that I can't seem to locate.

Thank you.

<%@ Language=VBScript %>

<!-- #include virtual=&quot;/scripts/header.asp&quot; -->


<%
Dim intRecordID, FDConference, strMSC, strLastName, strFirstName, strNickname, strMI
Dim strGradeRank, strMACOM, strOrganization, strTitle, strLocation, strWorkPhone
Dim strDSNPhone, strMobilePhone, strFaxNumber, strEmail, strSEmail, strYear1999
Dim strYear2000, strYear2002
Dim strFDTraining, strPreviousAssignments, strMiscellaneous, strFDOCourseGrad
Dim strSQLReturn, strSpecialtyCode
intRecordID = Request.QueryString(&quot;id&quot;)
%>


<% Select Case Request.ServerVariables(&quot;REQUEST_METHOD&quot;) %>

<% Case &quot;POST&quot;

intRecordID = Request.Form(&quot;intRecordID&quot;)
strMSC = trim(Request.Form(&quot;strMSC&quot;))
strLastName = trim(Request.Form(&quot;strLastName&quot;))
strFirstName = trim(Request.Form(&quot;strFirstName&quot;))
strNickname = trim(Request.Form(&quot;strNickname&quot;))
strMI = trim(Request.Form(&quot;strMI&quot;))
strGradeRank = trim(Request.Form(&quot;strGradeRank&quot;))
strMACOM = trim(Request.Form(&quot;strMACOM&quot;))
strOrganization = trim(Request.Form(&quot;strOrganization&quot;))
strTitle = trim(Request.Form(&quot;strTitle&quot;))
strLocation = trim(Request.Form(&quot;strLocation&quot;))
strWorkPhone = trim(Request.Form(&quot;strWorkPhone&quot;))
strDSNPhone = trim(Request.Form(&quot;strDSNPhone&quot;))
strMobilePhone = trim(Request.Form(&quot;strMobilePhone&quot;))
strFaxNumber = trim(Request.Form(&quot;strFaxNumber&quot;))
strEmail = trim(Request.Form(&quot;strEmail&quot;))
strSEmail = trim(Request.Form(&quot;strSEmail&quot;))
strYear1999 = trim(Request.Form(&quot;strYear1999&quot;))
strYear2000 = trim(Request.Form(&quot;strYear2000&quot;))
strYear2002 = trim(Request.Form(&quot;strYear2002&quot;))
strFDTraining = trim(Request.Form(&quot;strFDTraining&quot;))
strPreviousAssignments = trim(Request.Form(&quot;strPreviousAssignments&quot;))
strMiscellaneous = trim(Request.Form(&quot;strMiscellaneous&quot;))
strSpecialtyCode = trim(Request.Form(&quot;strSpecialtyCode&quot;))
strFDOCourseGrad = trim(Request.Form(&quot;strFDOCourseGrad&quot;))


strSQLReturn = &quot;UPDATE FDConference Set MSC = '&quot; & strMSC & &quot;', LastName = '&quot; & strLastName & &quot;', FirstName = '&quot; & strFirstName & &quot;', Nickname = '&quot; & strNickname & &quot;', MI = '&quot; & strMI & &quot;', GradeRank = '&quot; & strGradeRank & &quot;', MACOM = '&quot; & strMACOM & &quot;', Organization = '&quot; & strOrganization & &quot;', Title = '&quot; & strTitle & &quot;', Location = '&quot; & strLocation & &quot;', WorkPhone = '&quot; & strWorkPhone & &quot;', DSNPhone = '&quot; & strDSNPhone & &quot;', MobilePhone = '&quot; & strMobilePhone & &quot;', FaxNumber = '&quot; & strFaxNumber & &quot;', Email = '&quot; & strEmail & &quot;', SEmail = '&quot; & strSEmail & &quot;', Year1999 = '&quot; & strYear1999 & &quot;', Year2000 = '&quot; & strYear2000 & &quot;', Year2002 = '&quot; & strYear2002 & &quot;', FDTraining = '&quot; & strFDTraining & &quot;', PreviousAssignments = '&quot; & strPreviousAssignments & &quot;', Miscellaneous = '&quot; & strMiscellaneous & &quot;', SpecialtyCode = '&quot; & strSpecialtyCode & &quot;', FDOCourseGrad = '&quot; & strFDOCourseGrad & &quot;' where RecordID = '&quot; & intRecordID & &quot;'&quot;



oRecordSet = oConnection.Execute(strSQLReturn)

'DBReleaseConnection()

%>

<br><h3>Thank you for submitting your changes. The database has been updated. To view your updates, go to <a href=&quot;fdorecords.asp&quot;>The public list of records</a> and select the ID number. This will take you to that particular record.</h2>

</td>
</tr>
</table>

<% Case Else


DBGetRecords(&quot;SELECT * FROM FDConference WHERE RecordID = &quot; & intRecordID)
strMSC = oRecordSet(1)
strLastName = oRecordSet(2)
strFirstName = oRecordSet(3)
strNickname = oRecordSet(4)
strMI = oRecordSet(5)
strGradeRank = oRecordSet(6)
strMACOM = oRecordSet(7)
strOrganization = oRecordSet(8)
strTitle = oRecordSet(9)
strLocation = oRecordSet(10)
strWorkPhone = oRecordSet(11)
strDSNPhone = oRecordSet(12)
strMobilePhone = oRecordSet(13)
strFaxNumber = oRecordSet(14)
strEmail = oRecordSet(15)
strSEmail = oRecordSet(16)
strYear1999 = oRecordSet(18)

If strYear1999 = &quot;True&quot; Then
strYear1999 = &quot;Yes&quot;
Else
strYear1999 = &quot;No&quot;
End If

strYear2000 = oRecordSet(19)

If strYear2000 = &quot;True&quot; Then
strYear2000 = &quot;Yes&quot;
Else
strYear2000 = &quot;No&quot;
End If

strYear2002 = oRecordSet(20)

If strYear2002 = &quot;True&quot; Then
strYear2002 = &quot;Yes&quot;
Else
strYear2002 = &quot;No&quot;
End If


strFDTraining = oRecordSet(25)
strPreviousAssignments = oRecordSet(26)
strMiscellaneous = oRecordSet(27)
strSpecialtyCode = oRecordSet(28)
strFDOCourseGrad = oRecordSet(29)

If strFDOCourseGrad = &quot;True&quot; Then
strFDOCourseGrad = &quot;Yes&quot;
Else

strFDOCourseGrad = &quot;No&quot;

End If

%>

<TABLE BORDER=0 CELLPADDING=10>

<TD WIDTH=&quot;90%&quot;>


<p><center><b><font size=&quot;2&quot;>Foreign Disclosure Database Record Information</font></b>
<br><br>
<center>If you would like to add a picture to one of the records, please email it separate from this form in .jpg or .gif format to <a href=&quot;mailto:idev@dami.army.smil.mil&quot;>idev@dami.army.smil.mil</a>.<br> <b>** Please include the name of the person in the photo in your email, so that the photo will be attached to the correct record.</b></center><br><br></p>


<form id=&quot;EditDB&quot; NAME=&quot;EditDB&quot; ACTION=&quot;edit_database.asp&quot; method=&quot;post&quot;
METHOD=&quot;POST&quot;>

<table width=&quot;300px&quot; border=&quot;0&quot;>

<tr>
<td class=&quot;field&quot;><b>MACOM/CINC:</b>
</td>
<td><input name=&quot;strMACOM&quot; type=text size=40 value=&quot;<%= strMACOM %>&quot;>
</td>
<td class=&quot;field&quot;><b>MSC:</b>
</td>
<td><input name=&quot;MSC&quot; type=&quot;text&quot; size=40 value=&quot;<%= strMSC %>&quot;>
</td>
</tr>
<td class=&quot;field&quot;><b>Location:</b>
</td>
<td><input name=&quot;Location&quot; type=&quot;text&quot; size=40 value=&quot;<%= strLocation %>&quot;>
</td>
<td class=&quot;field&quot;><b>Organization:</b>
</td>
<td><input name=&quot;Organization&quot; type=&quot;text&quot; size=40 value=&quot;<%= strOrganization %>&quot;>
</tr>
<tr>
<td class=&quot;field&quot;><b>LastName:</b>
</td>
<td><input type=&quot;text&quot; name=&quot;LastName&quot; size=40 value=&quot;<%= strLastName %>&quot;>
</td>
<td class=&quot;field&quot;><b>First Name:</b>
</td>
<td><input name=&quot;FirstName&quot; type=text size=40 value=&quot;<%= strFirstName %>&quot;>
</td>
</tr>
<tr>
<td class=&quot;field&quot;><b>MI:</b>
</td>
<td><input name=&quot;MI&quot; type=text size=4 maxlength=4 value=&quot;<%= strMI %>&quot;>
</td>
<td class=&quot;field&quot;><b>Nickname:</b>
</td>
<td><input name=&quot;Nickname&quot; type=text size=20 value=&quot;<%= strNickname %>&quot;>
</td>
</tr>
<tr>
<td class=&quot;field&quot;><b>Title:</b>
</td>
<td><input type=&quot;text&quot; name=&quot;Title&quot; size=20 value=&quot;<%= strTitle %>&quot;>
</td>
<td class=&quot;field&quot;><b>Grade/Rank:</b>
</td>
<td><input type=&quot;text&quot; name=&quot;GradeRank&quot; size=20 value=&quot;<%= strGradeRank %>&quot;>
</td>

</tr>
<tr>
<td class=&quot;field&quot;><b>Email:</b>
</td>
<td><input type=text name=&quot;Email&quot; type=text size=40 value=&quot;<%= strEmail %>&quot;>
</td>
<td class=&quot;field&quot;><b>SIPRNET Email:</b>
</td>
<td><input type=text name=&quot;SEmail&quot; type=text size=40 value=&quot;<%= strSEmail %>&quot;>
</td>
</tr>
<tr>
<td class=&quot;field&quot;><b>Work Phone:</b>
</td>
<td>
<input type=text name=&quot;WPhone&quot; maxlength=12 value=&quot;<%= strWorkPhone %>&quot;>
</td>
<td class=&quot;field&quot;><b>DSN Phone:</b>
</td>
<td>
<input type=text name=&quot;DPhone&quot; maxlength=12 value=&quot;<%= strDSNPhone %>&quot;>
</td>
</tr>
<tr>
<td class=&quot;field&quot;><b>Fax:</b>
</td>
<td>
<input type=text name=&quot;FPhone&quot; maxlength=12 value=&quot;<%= strFaxNumber %>&quot;>
</td>
<td class=&quot;field&quot;><b>Mobile Phone:</b>
</td>
<td><input type=&quot;text&quot; name=&quot;MPhone&quot; maxlength=12 value=&quot;<%= strMobilePhone %>&quot;>
</td>
</tr>
<tr>
<td class=&quot;field&quot;><b>FDO Course Grad:</b>
</td>
<td><Select NAME=&quot;strFDOGrad&quot;>
<option value=&quot;Choose One&quot; <% If strFDOCourseGrad = &quot;Choose One&quot; then %> SELECTED<% end if %>>Choose One</option>
<option value=&quot;Yes&quot; <% If strFDOCourseGrad = &quot;1&quot; then %> SELECTED<% end if %>>Yes</option>
<option value=&quot;No&quot; <% If strFDOCourseGrad = &quot;0&quot; then %> SELECTED<% end if %>>No</option>
</select>
</td>
<td class=&quot;field&quot; valign-=&quot;top&quot;><b>FDO Training:</b>
</td>
<td><input type=&quot;text&quot; name=&quot;FDOTng&quot; size=&quot;40&quot; maxlength=&quot;500&quot; value=&quot;<%= strFDTraining %>&quot;>
</td>

</tr>
<td class=&quot;field&quot; valign=&quot;top&quot;><b>Attend FD Conference:</b>
</td>
<td><b>1999:</b>&nbsp;
<input type=&quot;text&quot; name=&quot;FDConf&quot; size=5 value=&quot;<%= strYear1999 %>&quot;>
&nbsp; &nbsp; <b>2000:</b>&nbsp;
<input type=&quot;text&quot; name=&quot;FDConf&quot; size=5 value=&quot;<%= strYear2000 %>&quot;>
&nbsp; &nbsp; <b>2002:</b>&nbsp;
<input type=&quot;text&quot; name=&quot;FDConf&quot; size=5 value=&quot;<%= strYear2002 %>&quot;>
</td>
<td class=&quot;field&quot;><b>Specialty Code:</b>
</td>
<td><input type=&quot;text&quot; name=&quot;Code&quot; size=40 value=&quot;<%= strSpecialtyCode %>&quot;>
</td>
</tr>
<tr>
<td class=&quot;field&quot;><b>Previous Assignments:</b>
</td>
<td><input type=&quot;text&quot; name=&quot;Previous&quot; size=40 value=&quot;<%= strPreviousAssignments %>&quot;>
</td>
<td class=&quot;field&quot;><b>Miscellaneous:</b>
</td>
<td><input type=&quot;text&quot; name=&quot;Misc&quot; size=40 value=&quot;<%= strMiscellaneous %>&quot;>
</td>

</tr>
</table>

<br>
<p><input TYPE=&quot;submit&quot; VALUE=&quot;Save Changes&quot;></p>

</form>
<br><br>
<p><a href=&quot;db_records.asp&quot;>Return to FDO Records List</a></p>
<% End Select %>

</td>
</table>

</td></tr></table>
</td>

<!-- Body Ends Here -->
<!-- #include virtual=&quot;/scripts/footer.asp&quot; -->
 
are u submitting it on the same page ??

If Yes then you should give condition at the start of Request paramete code that

If Request(&quot;GiveNameToButton&quot;)=&quot;Save Changes&quot; then

......................code

resonse.end
end if

Just explain from where values are passing.. Rushi Shroff Rushi@emqube.com
&quot;Life is beautiful.&quot;
 
That did not seem to work. One value is actually passing (MACOM). I am unsure where my error lies as far as the others are concerned.

Thank you for you assistance.
 
Never mind. Fixed my own problem. Forgot to set the form names to the field names.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top