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!

Can't update my Database with checkbox selected 1

Status
Not open for further replies.

Housemouse1

Technical User
Oct 23, 2002
4
US
I created a form for individuals to select their manpower by name. They select their manpower by putting a checkbox by the name. Then they click a button, a confirmation page appears with the user's new manpower list.

The problem is, after the user clicks the checkbox, I can't get the checkbox value to update into the database (MS Access) table. The database table name is [d_Manpower] and the column I am trying to update is [Keep]. Below is the code for the checkbox:

<TD><Input Type=Checkbox Name=&quot;Keep&quot; Value=1></TD>

Next is the code for the comfirmation page (I apologize for the length but I am desperate!):

<%@ Language=VBScript %>

<% 'Page Goal:Confirmation page is to show new Manpower that was check-marked. Check mark value
'is updated in Sonydemo database in table d_Manpower %>

<%
'Note: To select the new OCC column from the Manpower table for the designated oracle cost center
'and update field Keep with checkbox value.

dim rs
Set rs = server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open &quot;SELECT * FROM [d_Manpower] WHERE OCC='&quot; & Session(&quot;OCC&quot;) & &quot;'&quot;, DBConn
rs.Fields(&quot;Keep&quot;) = &quot;Keep&quot;
rs.Update

if rs.EOF then
rs.Close
set rs = nothing
Response.Redirect &quot;../common/inv_acs.asp&quot;
end if
%>

<html>

<head>
<title>Manpower Confirm</title>
</head>

<body>
<!-- #include file=&quot;../common/hdr.asp&quot; -->



<%
'write what is in the database fields


If rs.Fields(&quot;Keep&quot;) = 1 then

%>
<H3>Here is your updated manpower:</H3>
<%
Do While NOT rs.EOF

Response.Write &quot;<TABLE BORDER ='1'>&quot;
Response.Write &quot;<TR>&quot;
Response.Write &quot;<TD>&quot;
Response.Write rs(&quot;New_OCC&quot;)
Response.Write &quot;</TD>&quot;
Response.Write &quot;<TD>&quot;
Response.Write rs(&quot;Emply_No&quot;)
Response.Write &quot;</TD>&quot;
Response.Write &quot;<TD>&quot;
Response.Write rs(&quot;Name&quot;)
Response.Write &quot;</TD>&quot;
Response.Write &quot;<TD>&quot;
Response.Write rs(&quot;Job_Title&quot;)
Response.Write &quot;</TD>&quot;
rs.MoveNext
loop
end if
rs.Close
Set rs = nothing

%>
</body>
</HTML>
 
You need to do the following:

dim rs
Set rs = server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open &quot;SELECT * FROM [d_Manpower] WHERE OCC='&quot; & Session(&quot;OCC&quot;) & &quot;'&quot;, DBConn
rs.Fields(&quot;Keep&quot;) = request(&quot;Keep&quot;)
rs.Update
&quot;did you just say Minkey?, yes that's what I said.&quot;

MrGreed
 
Thanks for the suggestion. When I made the change from

rs.Fields(&quot;Keep&quot;) = (&quot;Keep&quot;) to

rs.Fields(&quot;Keep&quot;) = request(&quot;Keep&quot;), I get the following error message:

ADODB.Recordset error '800a0cb3'

Object or provider is not capable of performing requested operation.

/sonydemo/dc/mpconfirm.asp, line 13


Line 13 is the: rs.Fields(&quot;Keep&quot;) = request(&quot;Keep&quot;). I get the same error message if I take out &quot;request&quot;. Any other ideas???


 
You have IIS up and running? &quot;did you just say Minkey?, yes that's what I said.&quot;

MrGreed
 
Hello,

I think what you should you do is to move the
request(&quot;Keep&quot;) value in some variable first and then try to move that value in the recordset field variable. Below is the code.

mSomeVariable = request(&quot;Keep&quot;)
rs.Fields(&quot;Keep&quot;) = mSomeVariable

I hope it helps.

- krshaikh -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top