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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Error

Status
Not open for further replies.

gust1480

Programmer
Mar 19, 2002
148
PH
I have 2 asp page, query_portfolio and query_write. In my query_portfolio page, I have a link to query_write and when that link is clicked ,well obviously it goes to query_write page, it passes the value fundid, accountid, plannum and partnum which in turn is used by query_write and it works fine. In my query_write page, it also have a link to itself (it serves as a refresh button) that also passes the said value but an error occurs when this link is clicked. How come when I clicked the link to query_write in the query_portfolio no errors occurs but when I clicked the the link to itself (query_write) it produces an error! What’s wrong with my script?

Here’s the script along with the error it gives….

<%@ Language=VBScript %>
<%
Response.Expires=-1
Response.AddHeader &quot;Pragma&quot;, &quot;no-cache&quot;
Response.AddHeader &quot;cache-control&quot;, &quot;no-store&quot;
session(&quot;fundid&quot;) = Request.QueryString(&quot;fundid&quot;)
session(&quot;partnum&quot;) = Request.QueryString(&quot;partnum&quot;)
session(&quot;plannum&quot;)= Request.QueryString(&quot;plannum&quot;)
session(&quot;userid&quot;)= Request.QueryString(&quot;userid&quot;)
session(&quot;accountid&quot;)= Request.QueryString(&quot;accountid&quot;)
%>

<%

if trim(session(&quot;userid&quot;)) <> &quot;&quot; then
set fund=server.createobject(&quot;Adodb.connection&quot;)
fund.Open &quot;funds&quot;,&quot;sa&quot;,&quot;barit123&quot;

set inv=server.CreateObject(&quot;ADODB.connection&quot;)
inv.Open &quot;investor&quot;,&quot;sa&quot;,&quot;barit123&quot;

sql = &quot;SELECT * FROM CASHPOSITION WHERE ACCOUNT_NO = '&quot; & Request.QueryString(&quot;accountid&quot;) & &quot;'&quot;
set rs=inv.Execute(sql)

sqlid = &quot;select user_id from accounts where account_id = '&quot; & Request.QueryString(&quot;accountid&quot;) & &quot;'&quot;
id = inv.Execute(sqlid).fields(0).Value


dim myarray()
redim myarray(5)
ctr = 0
for each item in Request.Querystring

myarray(ctr) = Request.QueryString(item)
ctr=ctr + 1
next

fund_id = trim(Request.QueryString (&quot;fundid&quot;))
plan_no = trim(Request.QueryString(&quot;plannum&quot;))
partnum = Request.QueryString(&quot;partnum&quot;)
'THIS IS LINE 56
sql3 = &quot;select * from bpi_fund_outs where fund_id='&quot;& trim(myarray(0)) &&quot;' and user_id='&quot;& trim(myarray(2)) &&quot;' and plan_no ='&quot;& trim(myarray(3)) &&quot;' and os_bal_remaining<>0 and participant_no = &quot; & myarray(4) &&quot; &quot;
set rs_outs= fund.Execute(sql3)

if not rs_outs.eof and not rs_outs.bof then
share_oper=cdbl(trim(rs_outs(&quot;shares_hold_oper_remaining&quot;)))
share_wper=cdbl(trim(rs_outs(&quot;shares_hold_wper_remaining&quot;)))
contr_today=cdbl(trim(rs_outs(&quot;contr_today&quot;)))
end if



%>

<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<form METHOD=&quot;post&quot; action=&quot;/secured/confirm_sellfixed.asp&quot; id=&quot;form1&quot; name=&quot;form1&quot; onSubmit=&quot;return validate('form1');&quot;>
<BODY>
<%
sql4=&quot;select * from bpi_fund_omniparams where fund_id='&quot;& fund_id &&quot;' and plan_no ='&quot;& myarray(3) &&quot;'&quot;
set rs_omni=fund.Execute(sql4)
%>


<%
nav=trim(rs_omni(&quot;nav_sell&quot;))
erp=trim(rs_omni(&quot;erp_per_unit&quot;))
nav_orig=trim(rs_omni(&quot;nav_orig&quot;))
value_oper=share_oper*nav
value_wper=share_wper*erp
value_contr=contr_today*nav
total_share=cdbl(share_oper)+cdbl(share_wper)+cdbl(contr_today)
tot_value=cdbl(value_oper)+cdbl(value_wper)+cdbl(value_contr)%>

<table border=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td><br>
</td>
</tr>
</table>
<% if trim(Request.QueryString(&quot;plannum&quot;)) = &quot;000006&quot; then %>
<table border=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td bgcolor=&quot;#99CCFF&quot; height=&quot;20&quot;><font color=&quot;#663399&quot; size=&quot;1&quot; face=&quot;Verdana&quot;><b>
P O R T F O L I O</b></font></td>
</tr>
</table>
<%else %>
<table border=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td bgcolor=&quot;#99CCFF&quot; height=&quot;20&quot;><font color=&quot;#663399&quot; size=&quot;1&quot; face=&quot;Verdana&quot;><b>
P O R T F O L I O</b></font></td>
</tr>
</table>
<%end if%>
<BR>
<TABLE WIDTH=&quot;100%&quot; BORDER=0 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD bgcolor=#99ccff width=&quot;15%&quot; align=right><STRONG><FONT face=&quot;arial&quot; size=2 color=#663399>User ID &gt; </FONT></STRONG> </TD>
<TD bgcolor=lightyellow width=&quot;20%&quot; align=middle><STRONG><FONT face=&quot;arial&quot; size=2><%Response.Write id%></FONT></STRONG></TD>
<TD width=&quot;2%&quot;>&nbsp;</TD>
<TD bgcolor=#99ccff width=&quot;20%&quot; align=right><STRONG><FONT face=&quot;arial&quot; size=2 color=#663399>Account Name &gt; </FONT></STRONG> </TD>
<TD bgcolor=lightyellow width=&quot;30%&quot; align=middle><FONT face=&quot;arial&quot; size=2>
<%if not rs.EOF and not rs.BOF then
if trim(rs(&quot;account_name&quot;)) <> &quot;&quot; then
Response.Write rs(&quot;account_name&quot;)
else
Response.Write &quot;<BR>&quot;
end if
else
Response.Write &quot;&nbsp&quot;
end if%>
</FONT></STRONG></TD>
</TR>
</TABLE>
<BR>

<TABLE WIDTH=&quot;97%&quot; ALIGN=left BORDER=0 CELLSPACING=1 CELLPADDING=1>

'THIS PART IS THE REFRESH
<TR>
<TD width=&quot;35%&quot; ALIGN=right><A href=&quot;querywrite_funds.asp?fundid = <% Response.write session(&quot;fundid&quot;)%> &accountid=<%Response.Write session(&quot;accountid&quot;)%>&userid=<%Response.Write session(&quot;userid&quot;)%>&plannum=<%Response.Write session(&quot;plannum&quot;)%> &partnum = <%Response.Write session(&quot;partnum&quot;)%>&quot; target=_self>
<STRONG><FONT Face=&quot;Arial&quot; color=darkblue size=2>
Refresh Portfolio Page</FONT></STRONG></A></TD>
</TR>
</TABLE>
<br>
<br>

<TABLE WIDTH=&quot;82.1%&quot; align=center BORDER=0 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD width=&quot;30%&quot; bgcolor=#9999ff><FONT face=&quot;courier new&quot; size=2>&nbsp;</FONT></STRONG></TD>
<TD width=&quot;15%&quot; align=middle bgcolor=#9999ff><STRONG><FONT face=&quot;arial&quot; size=2 color=white>No. of <%if plan_no=&quot;000006&quot; then Response.Write &quot;Shares&quot; else Response.Write &quot;Units&quot; end if%></FONT></STRONG> </TD>
<TD align=middle bgColor=#9999ff width=15%><STRONG><FONT color=#ffffff face=Arial size=2>Price per <%if plan_no=&quot;000006&quot; then Response.Write &quot;Share&quot; else Response.Write &quot;Unit&quot; end if%></FONT></STRONG>
<TD width=&quot;20%&quot; align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Value</FONT></STRONG> </TD>
</TR>
<%if share_oper<>0 then
color=&quot;lightyellow&quot;%>

<TR>
<TD width=&quot;30%&quot; align=middle bgcolor=#9999ff><FONT face=&quot;arial&quot; size=2 color=white><STRONG>Outside Holding
Period</STRONG></FONT></TD>
<TD width=&quot;15%&quot; align=right bgcolor=lightyellow><FONT face=&quot;courier new&quot; size=2>
<%Response.Write formatnumber(share_oper,0)%></FONT></TD>
<TD align=right bgColor=#ffffe0 width=15%><FONT face=&quot;courier new&quot; size=2>
<%Response.Write nav%></FONT>
<TD width=&quot;20%&quot; align=right bgcolor=lightyellow><FONT face=&quot;courier new&quot; size=2>
<%Response.Write formatnumber(value_oper,2)%></FONT></TD>
</TR>
<%end if%>
<%if share_wper<>0 then
if color=&quot;lightyellow&quot; then
bcolor=&quot;lightgrey&quot;
color=&quot;lightgrey&quot;
else
bcolor=&quot;lightyellow&quot;
end if
%>
<TR>
<TD width=&quot;30%&quot; align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Within Holding Period</FONT></STRONG></TD>
<TD width=&quot;15%&quot; align=right bgcolor=<%Response.Write bcolor%>><FONT face=&quot;courier new&quot; size=2>
<%Response.Write formatnumber(share_wper,0)%></FONT></TD>
<TD align=right bgColor=<%Response.Write bcolor%> width=15%><FONT face=&quot;courier new&quot; size=2>
<%Response.Write erp%></FONT>
<TD width=&quot;20%&quot; align=right bgcolor=<%Response.Write bcolor%>><FONT face=&quot;courier new&quot; size=2>
<%Response.Write formatnumber(value_wper,2)%></FONT></TD>
</TR>
<%end if%>
<%if contr_today<>0 then
if color=&quot;lightyellow&quot; then
bcolor=&quot;lightgrey&quot;
color=&quot;lightgrey&quot;
else
bcolor=&quot;lightyellow&quot;
color=&quot;lightyellow&quot;
end if
%>
<TR>
<TD width=&quot;30%&quot; align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Contribution Today</FONT></STRONG></TD>
<TD width=&quot;15%&quot; align=right bgcolor=<%Response.Write bcolor%>><FONT face=&quot;courier new&quot; size=2>
<%Response.Write formatnumber(contr_today,0)%></FONT></TD>
<TD align=right bgColor=<%Response.Write bcolor%> width=15%><FONT face=&quot;courier new&quot; size=2>
<%Response.Write nav%></FONT>
<TD width=&quot;20%&quot; align=right bgcolor=<%Response.Write bcolor%>><FONT face=&quot;courier new&quot; size=2>
<%Response.Write formatnumber(value_contr,2)%></FONT></TD>
</TR>
<%
end if%>
<%if color=&quot;lightyellow&quot; then
bcolor=&quot;lightgrey&quot;
color=&quot;lightgrey&quot;
else
bcolor=&quot;lightyellow&quot;
end if%>
<TR>
<TD width=&quot;30%&quot; align=middle bgcolor=#9999ff ><STRONG><FONT color=#ffffff face=Arial size=2>Total <%if plan_no=&quot;000006&quot; then Response.Write &quot;Shares&quot; else Response.Write &quot;Units&quot; end if%></FONT></STRONG></TD>
<TD align=middle bgColor=<%Response.Write bcolor%> width=15%>
<DIV align=right><STRONG><FONT face=&quot;Courier New&quot;
size=2><%Response.Write formatnumber(total_share,0)%></FONT></STRONG></DIV>
<TD align=middle bgColor=#9999ff width=15%><STRONG><FONT color=#ffffff face=Arial size=2>Total Value</FONT></STRONG>
<TD width=&quot;20%&quot; align=right bgcolor=<%Response.Write bcolor%>><FONT face=&quot;courier new&quot; size=2><STRONG><%Response.Write formatnumber(tot_value,2)%></STRONG></FONT></TD>
</TR>

</TABLE>

<%
inv.Close
fund.Close
%>
<!--<BR><BR>
<INPUT TYPE=Submit value=Refresh>-->
</BODY>
</FORM>
<% else%>

<SCRIPT LANGUAGE =&quot;JavaScript&quot;>
window1 = open(&quot;bpi.asp&quot;,&quot;_top&quot;)
</script>

<%end if%>
</HTML>

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '='.

/querywrite_funds.asp, line 56
 
try placing single quotes around the writes in the href.
<A href=&quot;querywrite_funds.asp?fundid = '<% Response.write session(&quot;fundid&quot;)%>'
admin@onpntwebdesigns.com
 
after a loong boring meeting that I day dreamed in [lol]
I realized that was a stupid thing to try with the quotes in a link. sorry!

one thing, in your question you say when you submit the page to itself it doesn't work. well the one thing I can think is the use of request.querystring and a form method of POST being used. if you did submit this page you posted to itself it qould probably not work for that one reason. try changing the request.querystring to request.form and see how that works. either that or change to GET in the method attrib.
admin@onpntwebdesigns.com
 
I can't tell why your using the array to pul the values out. In my experince you can use both a POST method and a querystring such as you have, but could it be possible that assigning values to the array is your problem? I would double check and make sure the values are getting into your array in the correct order (or throw out the array all together and use Request.QueryString as you have it already in there). Other than that I can't see an error off the top of my head.
Print the SQL string out and make sure the values are being set correctly (comment out the execute function so you can see the print out).
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Maybe not the problem, but the Post action isnt great if your using request.querystring and also (I'm still fairly new to this) surely you don't need to pass the session variable in an hyperlink since these values are available for the whole session no matter what page you are on.
 
I agree, thanks for noticing. If you are already storing these values in session variables, that you should be able to just pull them back out, and in that case all you would need to do is refresh the page with javascript on the button click.
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top