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 "Pragma", "no-cache"
Response.AddHeader "cache-control", "no-store"
session("fundid"
= Request.QueryString("fundid"
session("partnum"
= Request.QueryString("partnum"
session("plannum"
= Request.QueryString("plannum"
session("userid"
= Request.QueryString("userid"
session("accountid"
= Request.QueryString("accountid"
%>
<%
if trim(session("userid"
) <> "" then
set fund=server.createobject("Adodb.connection"
fund.Open "funds","sa","barit123"
set inv=server.CreateObject("ADODB.connection"
inv.Open "investor","sa","barit123"
sql = "SELECT * FROM CASHPOSITION WHERE ACCOUNT_NO = '" & Request.QueryString("accountid"
& "'"
set rs=inv.Execute(sql)
sqlid = "select user_id from accounts where account_id = '" & Request.QueryString("accountid"
& "'"
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 ("fundid"
)
plan_no = trim(Request.QueryString("plannum"
)
partnum = Request.QueryString("partnum"
'THIS IS LINE 56
sql3 = "select * from bpi_fund_outs where fund_id='"& trim(myarray(0)) &"' and user_id='"& trim(myarray(2)) &"' and plan_no ='"& trim(myarray(3)) &"' and os_bal_remaining<>0 and participant_no = " & myarray(4) &" "
set rs_outs= fund.Execute(sql3)
if not rs_outs.eof and not rs_outs.bof then
share_oper=cdbl(trim(rs_outs("shares_hold_oper_remaining"
))
share_wper=cdbl(trim(rs_outs("shares_hold_wper_remaining"
))
contr_today=cdbl(trim(rs_outs("contr_today"
))
end if
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<form METHOD="post" action="/secured/confirm_sellfixed.asp" id="form1" name="form1" onSubmit="return validate('form1');">
<BODY>
<%
sql4="select * from bpi_fund_omniparams where fund_id='"& fund_id &"' and plan_no ='"& myarray(3) &"'"
set rs_omni=fund.Execute(sql4)
%>
<%
nav=trim(rs_omni("nav_sell"
)
erp=trim(rs_omni("erp_per_unit"
)
nav_orig=trim(rs_omni("nav_orig"
)
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="0" width="100%">
<tr>
<td><br>
</td>
</tr>
</table>
<% if trim(Request.QueryString("plannum"
) = "000006" then %>
<table border="0" width="100%">
<tr>
<td bgcolor="#99CCFF" height="20"><font color="#663399" size="1" face="Verdana"><b>
P O R T F O L I O</b></font></td>
</tr>
</table>
<%else %>
<table border="0" width="100%">
<tr>
<td bgcolor="#99CCFF" height="20"><font color="#663399" size="1" face="Verdana"><b>
P O R T F O L I O</b></font></td>
</tr>
</table>
<%end if%>
<BR>
<TABLE WIDTH="100%" BORDER=0 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD bgcolor=#99ccff width="15%" align=right><STRONG><FONT face="arial" size=2 color=#663399>User ID > </FONT></STRONG> </TD>
<TD bgcolor=lightyellow width="20%" align=middle><STRONG><FONT face="arial" size=2><%Response.Write id%></FONT></STRONG></TD>
<TD width="2%"> </TD>
<TD bgcolor=#99ccff width="20%" align=right><STRONG><FONT face="arial" size=2 color=#663399>Account Name > </FONT></STRONG> </TD>
<TD bgcolor=lightyellow width="30%" align=middle><FONT face="arial" size=2>
<%if not rs.EOF and not rs.BOF then
if trim(rs("account_name"
) <> "" then
Response.Write rs("account_name"
else
Response.Write "<BR>"
end if
else
Response.Write " "
end if%>
</FONT></STRONG></TD>
</TR>
</TABLE>
<BR>
<TABLE WIDTH="97%" ALIGN=left BORDER=0 CELLSPACING=1 CELLPADDING=1>
'THIS PART IS THE REFRESH
<TR>
<TD width="35%" ALIGN=right><A href="querywrite_funds.asp?fundid = <% Response.write session("fundid"
%> &accountid=<%Response.Write session("accountid"
%>&userid=<%Response.Write session("userid"
%>&plannum=<%Response.Write session("plannum"
%> &partnum = <%Response.Write session("partnum"
%>" target=_self>
<STRONG><FONT Face="Arial" color=darkblue size=2>
Refresh Portfolio Page</FONT></STRONG></A></TD>
</TR>
</TABLE>
<br>
<br>
<TABLE WIDTH="82.1%" align=center BORDER=0 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD width="30%" bgcolor=#9999ff><FONT face="courier new" size=2> </FONT></STRONG></TD>
<TD width="15%" align=middle bgcolor=#9999ff><STRONG><FONT face="arial" size=2 color=white>No. of <%if plan_no="000006" then Response.Write "Shares" else Response.Write "Units" 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="000006" then Response.Write "Share" else Response.Write "Unit" end if%></FONT></STRONG>
<TD width="20%" align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Value</FONT></STRONG> </TD>
</TR>
<%if share_oper<>0 then
color="lightyellow"%>
<TR>
<TD width="30%" align=middle bgcolor=#9999ff><FONT face="arial" size=2 color=white><STRONG>Outside Holding
Period</STRONG></FONT></TD>
<TD width="15%" align=right bgcolor=lightyellow><FONT face="courier new" size=2>
<%Response.Write formatnumber(share_oper,0)%></FONT></TD>
<TD align=right bgColor=#ffffe0 width=15%><FONT face="courier new" size=2>
<%Response.Write nav%></FONT>
<TD width="20%" align=right bgcolor=lightyellow><FONT face="courier new" size=2>
<%Response.Write formatnumber(value_oper,2)%></FONT></TD>
</TR>
<%end if%>
<%if share_wper<>0 then
if color="lightyellow" then
bcolor="lightgrey"
color="lightgrey"
else
bcolor="lightyellow"
end if
%>
<TR>
<TD width="30%" align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Within Holding Period</FONT></STRONG></TD>
<TD width="15%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" size=2>
<%Response.Write formatnumber(share_wper,0)%></FONT></TD>
<TD align=right bgColor=<%Response.Write bcolor%> width=15%><FONT face="courier new" size=2>
<%Response.Write erp%></FONT>
<TD width="20%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" size=2>
<%Response.Write formatnumber(value_wper,2)%></FONT></TD>
</TR>
<%end if%>
<%if contr_today<>0 then
if color="lightyellow" then
bcolor="lightgrey"
color="lightgrey"
else
bcolor="lightyellow"
color="lightyellow"
end if
%>
<TR>
<TD width="30%" align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Contribution Today</FONT></STRONG></TD>
<TD width="15%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" size=2>
<%Response.Write formatnumber(contr_today,0)%></FONT></TD>
<TD align=right bgColor=<%Response.Write bcolor%> width=15%><FONT face="courier new" size=2>
<%Response.Write nav%></FONT>
<TD width="20%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" size=2>
<%Response.Write formatnumber(value_contr,2)%></FONT></TD>
</TR>
<%
end if%>
<%if color="lightyellow" then
bcolor="lightgrey"
color="lightgrey"
else
bcolor="lightyellow"
end if%>
<TR>
<TD width="30%" align=middle bgcolor=#9999ff ><STRONG><FONT color=#ffffff face=Arial size=2>Total <%if plan_no="000006" then Response.Write "Shares" else Response.Write "Units" end if%></FONT></STRONG></TD>
<TD align=middle bgColor=<%Response.Write bcolor%> width=15%>
<DIV align=right><STRONG><FONT face="Courier New"
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="20%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" 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 ="JavaScript">
window1 = open("bpi.asp","_top"
</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
Here’s the script along with the error it gives….
<%@ Language=VBScript %>
<%
Response.Expires=-1
Response.AddHeader "Pragma", "no-cache"
Response.AddHeader "cache-control", "no-store"
session("fundid"
session("partnum"
session("plannum"
session("userid"
session("accountid"
%>
<%
if trim(session("userid"
set fund=server.createobject("Adodb.connection"
fund.Open "funds","sa","barit123"
set inv=server.CreateObject("ADODB.connection"
inv.Open "investor","sa","barit123"
sql = "SELECT * FROM CASHPOSITION WHERE ACCOUNT_NO = '" & Request.QueryString("accountid"
set rs=inv.Execute(sql)
sqlid = "select user_id from accounts where account_id = '" & Request.QueryString("accountid"
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 ("fundid"
plan_no = trim(Request.QueryString("plannum"
partnum = Request.QueryString("partnum"
'THIS IS LINE 56
sql3 = "select * from bpi_fund_outs where fund_id='"& trim(myarray(0)) &"' and user_id='"& trim(myarray(2)) &"' and plan_no ='"& trim(myarray(3)) &"' and os_bal_remaining<>0 and participant_no = " & myarray(4) &" "
set rs_outs= fund.Execute(sql3)
if not rs_outs.eof and not rs_outs.bof then
share_oper=cdbl(trim(rs_outs("shares_hold_oper_remaining"
share_wper=cdbl(trim(rs_outs("shares_hold_wper_remaining"
contr_today=cdbl(trim(rs_outs("contr_today"
end if
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<form METHOD="post" action="/secured/confirm_sellfixed.asp" id="form1" name="form1" onSubmit="return validate('form1');">
<BODY>
<%
sql4="select * from bpi_fund_omniparams where fund_id='"& fund_id &"' and plan_no ='"& myarray(3) &"'"
set rs_omni=fund.Execute(sql4)
%>
<%
nav=trim(rs_omni("nav_sell"
erp=trim(rs_omni("erp_per_unit"
nav_orig=trim(rs_omni("nav_orig"
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="0" width="100%">
<tr>
<td><br>
</td>
</tr>
</table>
<% if trim(Request.QueryString("plannum"
<table border="0" width="100%">
<tr>
<td bgcolor="#99CCFF" height="20"><font color="#663399" size="1" face="Verdana"><b>
P O R T F O L I O</b></font></td>
</tr>
</table>
<%else %>
<table border="0" width="100%">
<tr>
<td bgcolor="#99CCFF" height="20"><font color="#663399" size="1" face="Verdana"><b>
P O R T F O L I O</b></font></td>
</tr>
</table>
<%end if%>
<BR>
<TABLE WIDTH="100%" BORDER=0 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD bgcolor=#99ccff width="15%" align=right><STRONG><FONT face="arial" size=2 color=#663399>User ID > </FONT></STRONG> </TD>
<TD bgcolor=lightyellow width="20%" align=middle><STRONG><FONT face="arial" size=2><%Response.Write id%></FONT></STRONG></TD>
<TD width="2%"> </TD>
<TD bgcolor=#99ccff width="20%" align=right><STRONG><FONT face="arial" size=2 color=#663399>Account Name > </FONT></STRONG> </TD>
<TD bgcolor=lightyellow width="30%" align=middle><FONT face="arial" size=2>
<%if not rs.EOF and not rs.BOF then
if trim(rs("account_name"
Response.Write rs("account_name"
else
Response.Write "<BR>"
end if
else
Response.Write " "
end if%>
</FONT></STRONG></TD>
</TR>
</TABLE>
<BR>
<TABLE WIDTH="97%" ALIGN=left BORDER=0 CELLSPACING=1 CELLPADDING=1>
'THIS PART IS THE REFRESH
<TR>
<TD width="35%" ALIGN=right><A href="querywrite_funds.asp?fundid = <% Response.write session("fundid"
<STRONG><FONT Face="Arial" color=darkblue size=2>
Refresh Portfolio Page</FONT></STRONG></A></TD>
</TR>
</TABLE>
<br>
<br>
<TABLE WIDTH="82.1%" align=center BORDER=0 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD width="30%" bgcolor=#9999ff><FONT face="courier new" size=2> </FONT></STRONG></TD>
<TD width="15%" align=middle bgcolor=#9999ff><STRONG><FONT face="arial" size=2 color=white>No. of <%if plan_no="000006" then Response.Write "Shares" else Response.Write "Units" 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="000006" then Response.Write "Share" else Response.Write "Unit" end if%></FONT></STRONG>
<TD width="20%" align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Value</FONT></STRONG> </TD>
</TR>
<%if share_oper<>0 then
color="lightyellow"%>
<TR>
<TD width="30%" align=middle bgcolor=#9999ff><FONT face="arial" size=2 color=white><STRONG>Outside Holding
Period</STRONG></FONT></TD>
<TD width="15%" align=right bgcolor=lightyellow><FONT face="courier new" size=2>
<%Response.Write formatnumber(share_oper,0)%></FONT></TD>
<TD align=right bgColor=#ffffe0 width=15%><FONT face="courier new" size=2>
<%Response.Write nav%></FONT>
<TD width="20%" align=right bgcolor=lightyellow><FONT face="courier new" size=2>
<%Response.Write formatnumber(value_oper,2)%></FONT></TD>
</TR>
<%end if%>
<%if share_wper<>0 then
if color="lightyellow" then
bcolor="lightgrey"
color="lightgrey"
else
bcolor="lightyellow"
end if
%>
<TR>
<TD width="30%" align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Within Holding Period</FONT></STRONG></TD>
<TD width="15%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" size=2>
<%Response.Write formatnumber(share_wper,0)%></FONT></TD>
<TD align=right bgColor=<%Response.Write bcolor%> width=15%><FONT face="courier new" size=2>
<%Response.Write erp%></FONT>
<TD width="20%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" size=2>
<%Response.Write formatnumber(value_wper,2)%></FONT></TD>
</TR>
<%end if%>
<%if contr_today<>0 then
if color="lightyellow" then
bcolor="lightgrey"
color="lightgrey"
else
bcolor="lightyellow"
color="lightyellow"
end if
%>
<TR>
<TD width="30%" align=middle bgcolor=#9999ff><STRONG><FONT color=#ffffff face=Arial size=2>Contribution Today</FONT></STRONG></TD>
<TD width="15%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" size=2>
<%Response.Write formatnumber(contr_today,0)%></FONT></TD>
<TD align=right bgColor=<%Response.Write bcolor%> width=15%><FONT face="courier new" size=2>
<%Response.Write nav%></FONT>
<TD width="20%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" size=2>
<%Response.Write formatnumber(value_contr,2)%></FONT></TD>
</TR>
<%
end if%>
<%if color="lightyellow" then
bcolor="lightgrey"
color="lightgrey"
else
bcolor="lightyellow"
end if%>
<TR>
<TD width="30%" align=middle bgcolor=#9999ff ><STRONG><FONT color=#ffffff face=Arial size=2>Total <%if plan_no="000006" then Response.Write "Shares" else Response.Write "Units" end if%></FONT></STRONG></TD>
<TD align=middle bgColor=<%Response.Write bcolor%> width=15%>
<DIV align=right><STRONG><FONT face="Courier New"
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="20%" align=right bgcolor=<%Response.Write bcolor%>><FONT face="courier new" 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 ="JavaScript">
window1 = open("bpi.asp","_top"
</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