Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2005, 04:27 AM
Authorized User
 
Join Date: Dec 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Editing database with checkbox using asp

Hi all..I'm a newbie so actually I needed some help here.

Everytime I wanted to edit information from the list from my equipment.asp but it doesn't work. I had the error that says in the form:
Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.

I have codes for the equipment_edit.asp. Can someone here help to spot the problem? Greatly appreciated.

<%@LANGUAGE="VBSCRIPT"%>


<html>
<head>
<title>Edit Equipment</title>


<script type="text/javascript">
function chk_code(){
    if (document.form_equipment_edit.txt_ecode.value.leng th == 0){
        alert("Please enter an equipment code.");
        document.form_equipment_edit.txt_ecode.focus();
        return false;
    }
    else if (document.form_equipment_edit.txt_ename.value.leng th == 0){
        alert("Please enter an equipment name.");
        document.form_equipment_edit.txt_ename.focus();
        return false;
    }
    else
        return true;
}//end function
</script>
</head>


<body topmargin="0" leftmargin="0">
<%
if Request.Form.Count = 0 then
eid = Request.QueryString("eid")

%>


<table width="100%" border="0" cellspacing="0" cellpadding="5" bgcolor="#99ccff" height="30">
<tr>
    <td><b>ENGINE EQUIPMENT (Edit)</b></td>
</tr>
</table>

<%
Dim query_editEq, rs_editEq, eid
query_editEq = "Select * From Equipment Where EquipmentCode = "&eid
Set rs_editEq = Server.CreateObject("ADODB.Recordset")
Set rs_editEq = conn.Execute(query_editEq)

if NOT rs_editEq.EOF then
%>

<form name="form_equipment_edit" action="equipment_edit.asp" method="post" onSubmit="return chk_code();">
<table border="1" cellspacing="0" cellpadding="5" width="100%">
<tr>
    <td colspan="2"><%=Session("EquipmentExists")%></td>
</tr>
<tr>
    <td colspan="2"><input type="hidden" name="hidden_eid" value="<%=eid%>"></td>
</tr>
<tr>
     <th>Equipment Code</th>
    <td><input type="text" name="txt_ecode" size="70" value="<%=rs_editEq("EquipmentCode")%>">
     </td>
</tr>
<tr>
     <th>Equipment Name</th>
    <td><input type="text" name="txt_ename" size="70" value="<%=rs_editEq("EquipmentName")%>">
     </td>
</tr>
<tr>
     <th>Manufacturer</th>
    <td><input type="text" name="txt_emanufacturer" size="70" value="<%=rs_editEq("Manufacturer")%>"></td>
</tr>
<tr>
     <th>Model</th>
    <td><input type="text" name="txt_emodel" size="70" value="<%=rs_editEq("Model")%>"></td>
</tr>
<tr>
    <th></th>
    <td><input type="submit" name="btn_submit" value="Submit"></td>
    <td><input name="button" type="button" onClick="javascript:window.close()" value="Close Window"></td>
</tr>
</table>
</form>
<%
end if


else
eid = Request.Form("hidden_eid")

'Do the update here
Dim rs_updateEq, query_updateEq
query_updateEq = "UPDATE PMS_Equipment SET EquipmentCode='"&Request.Form("txt_ecode")&"', EquipmentName='"&Request.Form("txt_ename")&"', Manufacturer='"&Request.Form("txt_emanufacturer")& "', Model='"&Request.Form("txt_emodel")&"' Where EquipmentCode = "&eid
Set rs_updateEq = Server.CreateObject("ADODB.Recordset")
Set rs_updateEq = conn.Execute(query_updateEq)

Session("UpdateStatus") = "Update for Engine Equipment Code " & Request.Form("txt_ecode") & " successful."
Response.Redirect("equipment.asp")

end if
%>

</body>
</html>



I had a checkbox which is needed to be checked and edited from the equipment.asp file.

<input type="checkbox" name="rad_equipmID" value="<%=rs_displayEquip("EquipmentCode")%>">

This is the only value that is to be passed to equipment_edit.asp, but why am I unable to display the info in the textboxes in equipment_edit.asp for editing and saving?

Pls help. Thank u so much!
 
Old January 13th, 2005, 05:00 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Just print the query and see. That is see whether "eid" has some value while building this query. ["Select * From Equipment Where EquipmentCode = "&eid]


Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
checkbox from database ? please help me. majidnakit JSP Basics 0 September 14th, 2005 03:53 PM
ASP(C#) : datagrid editing - alert problem shazia1 VS.NET 2002/2003 0 July 4th, 2005 03:34 AM
Online editing in asp.net bneeraj General .NET 0 February 3rd, 2005 09:32 AM
Editing in Datagrid with ASP.NET rotsey General .NET 0 October 22nd, 2004 01:38 AM
Editing 3 Dimensional data in ASP.NET francislang General .NET 5 October 6th, 2004 04:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.