Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 06-17-2004, 02:08 PM asp code trouble
Junior Talker

Posts: 1
Trades: 0
I am attempting to create a web page in asp that allows users to edit exisitng data from an sql server database. When the user chooses a selection from the drop down the id for that selection is passed over to a new page that displays that particular id's information. The new page allows the user to this information, submit and the db becomes updated with the new info over writting what was oringinally there. This is the code for that edit page. Hopefully some1 can help me out I am getting an Object required error on line 235. I have put questions marks around that line.

<%@ Language=VBScript %>

<%
Const adVarChar = 200
Const adInteger = 3
'Const adDate = 7
Const adCurrency = 6
Const adParamInput = &H0001

Dim objConn
Dim objCmd
Dim objCmd2
DIm strSql
Dim objRS
Dim objRS2
Dim objRS3
Dim iCustId
Dim iActive
Dim iParticipant, iProgId, iPrintcost, iCatalogcost, iTeasercost, iWebcost, iStatus, iOthercost,iCreditlimit,iPname, iPtype, iPcode, iSummary, iService, iCustomerservice, iCatalog, iPoster, iLevel, iAge, iGeo, iMale, iFemale

'Dim iProgDate

iCustId = Request("custid")
iActive = Request("active")
'iProgDate = Request("progdate")
iProgId = Request("progid")

'*************** MAKE CONNECTION ********************
Set objConn = CreateObject("ADODB.Connection")
objConn.Open Application("Conn_ConnectionString")

If Request.Form("Update") <> "" Then
iParticipant=Request.Form("participant")
iParticipant=Request.Form("participant")
iPrintcost=Request.Form("pprintcost")
iCatalogcost=Request.Form("pcatalogcost")
iTeasercost=Request.Form("pteasercost")
iWebcost=Request.Form("pwebcost")
iStatus=Request.Form("pstatus")
'iOthercost=Request.Form("pothercost")
iCreditlimit=Request.Form("creditlimit")
iPname=Request.Form("pname")
Ptype=Request.Form("ptype")
iPcode=Request.Form("pcode")
iSummary=Request.Form("summary")
iService=Request.Form("service")
iCustomerservice=Request.Form("customerservicerepi d")
iCatalog=Request.Form("pcatalog")
iPoster=Request.Form("pposter")
iLevel=Request.Form("rlevel")
iAge=Request.Form("demoage")
iGeo=Request.Form("demogeo")
iMale=Request.Form("demom")
iFemale=Request.Form("demof")
Set objCmd=Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection=objConn
'******* STORED PROCEDURE CALL ********
objCmd.CommandText="_SP_ProgramData_Update"
objCmd.CommandType=4
'************ ADD PARAMETERS **********
objCmd.Parameters.Append objCmd.CreateParameter ("@progid",adInteger,adParamInput,,Cint(Request.Fo rm("progid")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@progdate",adDate,adParamInput,,(iProgDate))
'objCmd.Parameters.Append objCmd.CreateParameter ("@participant",adInteger,adParamInput,,Cint(Reque st.Form("participant")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pprintcost",adVarChar,adParamInput,2000,Cstr(Re quest.Form("pprintcost")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pcatalogcost",adVarChar,adParamInput,2000,Cstr( Request.Form("pcatalogcost")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pteasercost",adVarChar,adParamInput,2000,Cstr(R equest.Form("pteasercost")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pwebcost",adVarChar,adParamInput,2000,Cstr(Requ est.Form("pwebcost")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pstatus",adInteger,adParamInput,50,Cint(Request .Form("pstatus")))
'objCmd.Parameters.Append objCmd.CreateParameter("@pothercost",adVarChar,adP aramInput,2000,Cstr(Request.Form("pothercost")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@creditlimit",adCurrency,adParamInput,,Ccur(Requ est.Form("creditlimit")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pname",adVarChar,adParamInput,50,Cstr(Request.F orm("pname")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@ptype",adVarChar,adParamInput,50,Cstr(Request.F orm("ptype")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pcode",adVarChar,adParamInput,50,Cstr(Request.F orm("pcode")))

'objCmd.Parameters.Append objCmd.CreateParameter ("@summary",adVarChar,adParamInput,4000,Cstr(Reque st.Form("summary")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@service",adVarChar,adParamInput,4000,Cstr(Reque st.Form("service")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@customerservicerepid",adInteger,adParamInput,,C int(Request.Form("customerservicerepid")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pcatalog",adVarChar,adParamInput,500,Cstr(Reque st.Form("pcatalog")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@pposter",adVarChar,adParamInput,500,Cstr(Reques t.Form("pposter")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@rlevel",adVarChar,adParamInput,50,Cstr(Request. Form("rlevel")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@demoage",adInteger,adParamInput,,Cint(Request.F orm("demoage")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@demogeo",adVarChar,adParamInput,60,Cstr(Request .Form("demogeo")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@demom",adInteger,adParamInput,,Cint(Request.For m("demom")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@demof",adInteger,adParamInput,,Cint(Request.For m("demof")))

set objRS = objCmd.Execute
End If
%>
<%
If Request.Form("progid") >0 Then

Set objCmd2=Server.CreateObject("ADODB.Command")
objCmd2.ActiveConnection=objConn
'******* STORED PROCEDURE CALL ********
objCmd2.CommandText="_SP_ProgramData_Select"
objCmd2.CommandType=4
'************ ADD PARAMETERS **********
objCmd2.Parameters.Append objCmd2.CreateParameter ("@progid",adInteger,adParamInput,,Cint(Request.Fo rm("progid")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@progdate",adDate,adParamInput,,(iProgDate))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@psummary",adVarchar,adParamInput,,Cstr(Request. Form("psummary")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@participant",adInteger,adParamInput,,Cint(Reque st.Form("participant")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pprintcost",adVarChar,adParamInput,2000,Cstr(Re quest.Form("pprintcost")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pcatalogcost",adVarChar,adParamInput,2000,Cstr( Request.Form("pcatalogcost")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pteasercost",adVarChar,adParamInput,2000,Cstr(R equest.Form("pteasercost")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pwebcost",adVarChar,adParamInput,2000,Cstr(Requ est.Form("pwebcost")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pstatus",adInteger,adParamInput,50,Cint(Request .Form("pstatus")))
objCmd2.Parameters.Append objCmd2.CreateParameter("@pothercost",adVarChar,ad ParamInput,2000,Cstr(Request.Form("pothercost")))
'objCmd.Parameters.Append objCmd.CreateParameter ("@creditlimit",adCurrency,adParamInput,,Ccur(Requ est.Form("creditlimit")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pname",adVarChar,adParamInput,50,Cstr(Request.F orm("pname")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@ptype",adVarChar,adParamInput,50,Cstr(Request.F orm("ptype")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pcode",adVarChar,adParamInput,50,Cstr(Request.F orm("pcode")))

objCmd2.Parameters.Append objCmd2.CreateParameter ("@summary",adVarChar,adParamInput,4000,Cstr(Reque st.Form("summary")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@service",adVarChar,adParamInput,4000,Cstr(Reque st.Form("service")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@customerservicerepid",adInteger,adParamInput,,C int(Request.Form("customerservicerepid")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pcatalog",adVarChar,adParamInput,500,Cstr(Reque st.Form("pcatalog")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@pposter",adVarChar,adParamInput,500,Cstr(Reques t.Form("pposter")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@rlevel",adVarChar,adParamInput,50,Cstr(Request. Form("rlevel")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@demoage",adInteger,adParamInput,,Cint(Request.F orm("demoage")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@demogeo",adVarChar,adParamInput,60,Cstr(Request .Form("demogeo")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@demom",adVarChar,adParamInput,2,Cstr(Request.Fo rm("demom")))
objCmd2.Parameters.Append objCmd2.CreateParameter ("@demof",adVarChar,adParamInput,2,Cstr(Request.Fo rm("demof")))

set objRS2 = objCmd2.Execute
End If
%>

<%
strSql = "select pname, progid, custid, companyname from program_data where active = 1 order by companyname"
'Set objCmd2=Server.CreateObject("ADODB.Command")
'objCmd2.ActiveConnection=objConn
'******* STORED PROCEDURE CALL ********
'objCmd2.CommandText="_SP_CustomerId"
'objCmd2.CommandType=4
'objCmd.Parameters.Append objCmd.CreateParameter ("@custid",adInteger,adParamInput,,Cint(Request.Fo rm("custid")))
set objRS3 = objConn.Execute (strSql)
%>


<%

'Dim objCmd
Dim objRS4

Set objConn = CreateObject("ADODB.Connection")
objConn.Open Application("Conn_ConnectionString")
Set objCmd=Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection=objConn
'******* STORED PROCEDURE CALL ********
objCmd.CommandText="_SP_ProgramId"
objCmd.CommandType=4

set objRS4 = objCmd.Execute
%>
<html>
<head>
<style>
<!--
BODY{
scrollbar-face-color:white;
scrollbar-arrow-color:black;
scrollbar-track-color:white;
scrollbar-shadow-color:black;
scrollbar-highlight-color:white;
scrollbar-3dlight-color:white;
scrollbar-darkshadow-Color:white;
}
-->
</style>
<LINK REL="stylesheet" type="text/css" HREF="master.css">
<HEAD>
<title>:: EDIT PROGRAMS ::</title>


<SCRIPT LANGUAGE="JavaScript">

function blockError(){return true;}
window.onerror = blockError;

</script>

<body>

<form method="get" action="program_edit.asp?progid" name="myform" onSubmit="return validate()">

<center>

<table border=1 bordercolor="black" cellpadding="2" cellspacing="2">
<tr><td align=center bgcolor="#9D3246"><font size="4" color="white"><b>Edit Program *** <%=iProgId%> ****</b></font></td><td align=center bgcolor="#9D3246">



<font size="5" color="white"><%=trim(objRS3.fields("custid"))%></font>
<%=trim(objRS3.fields("companyname"))%>

<%objRS3.MoveNext%>

</select></td></tr>
<tr>
<td width="33%" align="center"><b>Program Name</b>:&nbsp;
<select name="progDD" onChange="javascript:selectedProg()">
<option value="0">- Please Select a Program -</option>
<%
'Dim iProgId
Do until objRS4.EOF%>
<option value="<%=trim(objRS4.fields("progid"))%>">
<%=objRS4.fields("pname")%>
</option>
<% iProgID = objRS4.fields("progid")
objRS4.MoveNext%>
<%Loop
%>
</select>
</td>
<!-- <tr>
<td width="33%" align="center"><b>Program Name</b>:&nbsp;<input type="text" name="pname" value="<%=iPname%>"><font size="" color="red"><b>*</b></font><br>
</td>
-->
<td align="center"><select name="ptype">

<option>- Please Select a Program Type -</option>
<option>Points</option>
<option>Levels</option>
<option>Sweepstakes</option>
<option>Event</option>
<option>Customer Loyalty</option>
<option>Sales Incentive</option>
<option>Service Awards</option>
<option>Employee Recognition</option>
<option>Other</option>
</select></td>
</tr>
<td align="center"><b>Summary of Program</b>:&nbsp;<br>

???????????????? <textarea name="psummary" wrap=physical cols=28 rows=2 value="<%objRS2.fields="psummary"%>"></textarea> ??????????????????

<font size="" color="red"><b>*</b></font><br>

</td>
<td align="center"><b>If Other, please describe</b>:&nbsp;<br>

<textarea name="summary" wrap=physical cols=28 rows=2 value="<%=objRS2.fields="summary"%>"></textarea>

</td>
</tr>
<tr>
<td align="center"><b>Primary Vehicle Used to Promote Program</b> <br>
<textarea name="" rows="" cols="" ></textarea></td>
<td align="center"> <b>Secondary Vehicle Used to Promote Program </b><br>


<textarea name="" rows="" cols=""></textarea>

</td>
</tr>
<tr colspan="2">
<td align="center"><b>Program Status</b>:<br>

<b>Active</b> <input type="radio" name="pstatus" onClick="radio_selection='active'" value="<%=objRS2.fields="status"%>">
<b>Inactive</b><input type="radio" name="pstatus" onClick="radio_selection='inactive'" value="<%=objRS2.fields="status"%>"><br>
<b>Program Duration:</b><br><input type="text" name="" size="6" > <b>through</b> <input type="text" name="" size="6" ><br><b>(mm/dd/yyyy)</b></td>

<td align="center"><b>Program Budget / Cost to Produce:</b><br><b>Print:</b> <input type="text" size=11 name="pprintcost" value="<%=objRS2.fields="pprintcost"%>" >&nbsp;<b>Catalog:</b> <input type="text" size=11 name="pcatalogcost" value="<%=objRS2.fields="pcatalogcost"%>" ><br>&nbsp;<b>Teaser:</b> <input type="text" size=11 name="pteasercost" value="<%=objRS2.fields="pteasercost"%>" >&nbsp;<b>Website:</b> <input type="text" size=11 name="pwebcost" value="<%=objRS2.fields="pwebcost"%>"><br>&nbsp;<b >Other:</b> <input type="text" size=11 name="pothercost" value="<%=objRS2.fields="pothercost"%>" ></td>
</tr>
<tr>

<td align="center">

<b>Number of Partcipants</b>:&nbsp;<input type=text value="<%=objRS2.fields="participant"%>"><br>
<b>Partcipant Demographics</b>:<br>
<b>Average Age</b>:&nbsp;<input type=text size="2" value="<%=objRS2.fields="demoage"%>" >
<b>Male:&nbsp;<input type=text size="2" value="<%=objRS2.fields="demom"%>" >%</b>&nbsp;<b>Female:&nbsp;<input type=text size="2" value="<%=objRS2.fields="demof"%>">
<b>Geography</b>:&nbsp;<input type="text" name="demogeo" size="20" value="<%=objRS2.fields="demogeo"%>" >


</td>
<td align="center"><b>If Other, please describe</b>:&nbsp;<br>

<textarea name="" wrap=physical cols=28 rows=2 ></textarea>
<br>
</td>
</tr>
<tr>
<td align="center">
<select name="rlevel" value="<%=objRS2.fields="rlevel"%>"><option>- Please Select a Expected Redemption Level -</option>
<option>Jobbers</option>
<option>Bulk Sale</option></select><br>
<b>Credit Limit</b>: <input type="text" size=14 name="creditlimit" value="<%=objRS2.fields="creditlimit"%>" ><font size="" color="red"><b>*</b></font><br>

<b>Service Level Promised</b>:&nbsp;<br>

<textarea name="service" wrap=physical cols=28 rows=2 value="<%=objRS2.fields="service"%>"></textarea>
<br>

</td>

<td align="center">
<select name="customerservicerepid" value="<%=objRS2.fields="customerservicerepid"%>"> <option>- Please Select a Customer Service Rep -</option>
<option>Rep 1</option>
<option>Rep 2</option>
<option>Rep 3</option>
<option>Rep 4</option>
<option>Rep 5</option></select><br>
<select name="salessupportid" value="<%=objRS2.fields="salessupportid"%>"><optio n>- Please Select a Sales Support Rep -</option>
<option>Rep 1</option>
<option>Rep 2</option>
<option>Rep 3</option>
<option>Rep 4</option>
<option>Rep 5</option></select><br>
<select name="repid" value="<%=objRS2.fields="repid"%>"><option>- Please Select a Sales Support Coordinator -</option>
<option>Rep 1</option>
<option>Rep 2</option>
<option>Rep 3</option>
<option>Rep 4</option>
<option>Rep 5</option></select><br>
<b>Customer Importance Rating</b>:&nbsp;&nbsp;<input type="text" name="" size="7"></td>
</tr>
</table>
<table>
<tr>
<input type="hidden" name="Update" Value="1">
<input type="hidden" name="custid" Value="<%=iCustId%>">
<input type="hidden" name="progID" Value="<%=iProgID%>">
<td ><input type="submit" value=" Submit Program Data " name="myform" onClick="checkForm()"></td>
</tr>
<tr>
<td ><input type="button" action="program_item.asp" name="myform" value=" Maintain Items " onClick="checkForm()"></td>
</tr>

</table>
<font size="2" color="red"><b>* Please note these fields are required!</b></font>
</form>

</center>
<%

Set objRS = nothing '******************************'
objConn.Close '***** CLOSE THINGS DOWN ******'
Set objConn = nothing '******************************'
%>
</body>
</head>
</html>

Last edited by jmaresca2004; 06-17-2004 at 02:10 PM..
jmaresca2004 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-17-2004, 03:09 PM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
jmaresca,

"Fields" is a collection on the recordset and while you use it in a way familiar to me in other places (see code snippet below), it appears that on the line in question you attempt to assign it to a string. Is that proper? Without a reference in front of me, I can't say. I notice that you repeat that action in other instances further down the document.

I assume you are trying to retrieve the value from within the objRS2 recordset under the "psummary" field and assign it to the textarea. If so, then repeat the action you performed earlier, such as in

Code:
iProgID = objRS4.fields("progid")
If your intention is something other than that, let me know and I'll look at it again with fresh eyes.

Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Reply     « Reply to asp code trouble
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.01178 seconds with 12 queries