Forums

ASP

This topic is locked

Incompatibility in retrieving data

Posted 01 Jun 2003 01:16:05
1
has voted
01 Jun 2003 01:16:05 Dalton Gilson posted:
Hi Gurus
Something quite strange is happening with one of my scripts -- I'm building a site with ASP pages managing a SQL Server 2000 database, from dealing with "Contracts" of all kinds (in Portuguese).
- The goal of this actual set of pages is to allow Users to calculate the evolution of the price of (for instance) a periodic payment of a Contract in accordance with the escalation of economic costs -- please be acknowledged that in Brasil the recalculation of prices in Contracts only can be made after a period of at least 12 months (that's to say: everyone recalculates its costs each 12 months...).
- In a first page ("calcatualizacao", the User will pick, from the database table "indecontb" (that stands for "INDices ECONomicos TaBle, a page that shows the monthly evolution of 04 different types of economic indexes), the index (as his Contract settles) that must be considered for calculating the price he wants to recalculate -- its code is here:
<pre id=code><font face=courier size=2 id=code>&lt;%@enablesessionstate=false%&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;
&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;Contratos on Line &nbsp;:&nbsp; Atualize o valor do seu Contrato conforme o &nbsp;Índice econômico&lt;/TITLE&gt;
&lt;META http-equiv=Content-Type content="text/html; charset=windows-1252"&gt;
&lt;LINK href="../../../inc/estiloCoL.css" type=text/css rel=stylesheet&gt;&lt;/HEAD&gt;
&lt;BODY&gt;.....
&lt;FORM name="calcatualizacao" method="POST" action="../../../biblioteca/indseconomicos/calcatualizacao2.asp"&gt;
Qual o índice utilizado pelo seu Contrato &#151; ou que Você queira atualizar?&lt;br&gt;
&lt;input type="radio" name="indatualiz" value="igpm"&gt; "IGP-&lt;i&gt;M&lt;/i&gt;" - Índice Geral de Preços do &lt;i&gt;Mercado financeiro&lt;/i&gt;&lt;BR&gt;
&lt;input type="radio" name="indatualiz" value="igpdi"&gt; "IGP-&lt;i&gt;DI&lt;/i&gt;" - Índice Geral de Preços - &lt;i&gt;Disponibilidade Interna&lt;/i&gt;&lt;BR&gt;
&lt;input type="radio" name="indatualiz" value="ipca"&gt; "IPCA" - Índice de Preços ao Consumidor - &lt;i&gt;Ampliado&lt;/i&gt;&lt;BR&gt;
&lt;input type="radio" name="indatualiz" value="poup01"&gt; Índice de Rendimentos da &lt;i&gt;Caderneta de Poupança&lt;/i&gt; do dia 1º do mês&lt;/DIV&gt;
.....(there comes the "reset" and the "submit" buttons&lt;/FORM&gt;&lt;/BODY&gt;&lt;/HTML&gt;</font id=code></pre id=code>;
- In the second page ("calcatualizacao2", a "form" is opened for the User:
(1st) inform the actual value of the Contract he wants to recalculate -- this information will be collected directly through an "input"; and, after,
(2st) indicate the month-and-year he wants to bring that value to -- choosing the respective row directly from a list of the data of that "indecontb" table (each row informs the month/year and the amount of the choosen index, its last number and, more, the cumulative escalation of the "last 12 months";
- both part run inside the same form, but there is no "Submit" button in this page, because the link to the next page comes automatically when clicking one of these rows in the database table -- its code is also here:
<pre id=code><font face=courier size=2 id=code>&lt;%@ LANGUAGE = "VBScript"
ENABLESESSIONSTATE = False %&gt;
&lt;%
Option Explicit
On Error Resume Next
Response.Expires = 0
%&gt;
&lt;!-- #include virtual="../../../inc/inc-conexao.asp" --&gt;
&lt;!-- #include virtual="../../../inc/clsDatefunctions.asp" --&gt;
&lt;%
Dim objConn, objRS, strQ, x, varcodigoind
Dim strConnection
dim date_functions
Call abre_objConn

Set date_functions = new classDateFunctions
Set objRS = Server.CreateObject("ADODB.Recordset"
x = request.form("indatualiz"
varcodigoind = request.querystring("tit"
Set objRS.ActiveConnection = objConn

strQ = "SELECT TOP 24 indecontb.codigoind, indecontb.mesind, indecontb.anoind, indecontb.numeroind, indecontb.varmesind, indecontb.vardozemesind FROM indecontb WHERE tipoind LIKE '%" & x & "%' ORDER BY anoind DESC, mesind DESC"

objRS.Open strQ
%&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;
&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;Contratos on Line &nbsp;:&nbsp; Atualize o valor do seu &nbsp;Contrato conforme o &nbsp;Índice econômico&lt;/TITLE&gt;
&lt;META http-equiv=Content-Type content="text/html; charset=windows-1252"&gt;
&lt;LINK href="../../../inc/estiloCoL.css" type=text/css rel=stylesheet&gt;
&lt;!-- #include virtual = "../inc/scrollbarbranco.css" --&gt;&lt;/head&gt;

&lt;BODY background="../../../imagens/back1.gif" onload="document.calcatualizacao2.valatualiz.focus()"&gt;.....
&lt;FORM name="calcatualizacao2" method="POST" action="../../../biblioteca/indseconomicos/calcatualizacao3.asp"&gt;
&lt;DIV style="position:absolute; align:center; top:120px; width:526px; font-family:verdana,arial; color:#000066; size:8pt;"&gt;&lt;B&gt;&nbsp;Valor do Contrato ou parcela que Você queira atualizar: R$ &lt;/B&gt;&lt;INPUT name="valatualiz" size=11 maxLength=15&gt;&lt;/DIV&gt;&lt;BR&gt;

&lt;ilayer width=526 height=178&gt;&lt;DIV style="position:absolute; align:left; left:10px; top:150px; width:526px; font-family:verdana,arial; color:#000066; size:8pt;"&gt;&lt;B&gt;&nbsp;Clique sobre o mês/ano para o qual Você quer trazer o valor contratual:&lt;/B&gt;

&lt;layer width=526 height=2000&gt;
&lt;div style="left:5px; top:140; width:526px; height:150px; overflow:scroll;"&gt;

&lt;TABLE class="letras" style="BEHAVIOR: url(../../../inc/sort.htc); BACKGROUND-COLOR: #E6E8FA" borderColor=#FFFFFF cellSpacing=0 cellPadding=2 border=1&gt;

&lt;THEAD&gt;&lt;TR align=left&gt;
&lt;TD align="center" background="../../../imagens/blankEFEBEF.gif" width="70" style="font-family:verdana,tahoma,arial; font-size:7.5pt; color:#880000;"&gt;&lt;B&gt;Mês/Ano&lt;/B&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;%
if x = "igpm" then
x = "IGP-M"
elseif x = "igpdi" then
x = "IGP-DI"
elseif x = "ipca" then
x = "IPCA"
elseif x = "poup01" then
x = "Poupança : dia 1º"
end if
%&gt;
&lt;TD align="left" background="../../../imagens/blankEFEBEF.gif" width="165" style="font-family:verdana,tahoma,arial; font-size:7.5pt; color:#880000;"&gt;&lt;B&gt;&nbsp;&lt;% = x %&gt; do mês&lt;/B&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="left" background="../../../imagens/blankEFEBEF.gif" width="150" style="font-family:verdana,tahoma,arial; font-size:7.5pt; color:#880000;"&gt;&lt;B&gt;&nbsp;% &lt;i&gt;X&lt;/i&gt; último mês&lt;/B&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD align="left" background="../../../imagens/blankD8D9B0.gif" width="150" style="font-family:verdana,tahoma,arial; font-size:7.5pt; color:#880000;"&gt;&lt;B&gt;&nbsp;% &lt;i&gt;X&lt;/i&gt; últimos 12 meses&lt;/B&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/THEAD&gt;

&lt;TBODY&gt;
&lt;%
While Not objRS.EOF
Response.Write "&lt;TR&gt;&lt;TD align='center' valign='top' width='70'&gt;&lt;FONT color=#000066 size=1&gt;&lt;a href='../../../biblioteca/indseconomicos/calcatualizacao3.asp?tit=" & objRs("codigoind" & "'&gt;" & objRS("mesind" & "/" & objRS("anoind" & "&lt;/a&gt;&lt;/FONT&gt;&lt;/TD&gt;"

Response.Write "&lt;TD align='right' valign='top' width='165'&gt;&lt;FONT color=#000066 size=1&gt;&lt;a href='../../../biblioteca/indseconomicos/calcatualizacao3.asp?tit=" & objRs("codigoind" & "'&gt;" & FormatNumber(objRS("numeroind", 4, -1) & "&lt;/a&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/FONT&gt;&lt;/TD&gt;"

Response.Write "&lt;TD align='right' valign='top' width='150'&gt;&lt;FONT color=#000066 size=1&gt;&lt;a href='../../../biblioteca/indseconomicos/calcatualizacao3.asp?tit=" & objRs("codigoind" & "'&gt;" & FormatNumber(objRS("varmesind", 4, -1) & "&nbsp;%&lt;/a&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/FONT&gt;&lt;/TD&gt;"

Response.Write "&lt;TD align='right' valign='top' background='../../../imagens/blankFFF7E7.gif' width='150'&gt;&lt;FONT color=#880000 size=1&gt;&lt;a href='../../../biblioteca/indseconomicos/calcatualizacao3.asp?tit=" & objRs("codigoind" & "'&gt;" & FormatNumber(objRS("vardozemesind", 4, -1) & "&nbsp;%&lt;/a&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/FONT&gt;&lt;/TD&gt;"
objRS.MoveNext
Wend

objRS.close
Call fecha_objConn
Set objRS = Nothing
%&gt;
&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/layer&gt;&lt;/DIV&gt;&lt;/ilayer&gt;&lt;/FORM&gt;..... (and, finally, just the "back" button)</font id=code></pre id=code>
- ...but the problem appears when We reach the "page3" ("calcatualizacao3" intended to show this data (and where the program will make a simple calculation of the actual value X the desired escalation index, and show the new value):
- almost all data are shown - unless the "actual contractual value" (that one that is picked directly from an "input" at "calcatualizacao2" page)
- I cannot reach why! I even tried transfering that "input" command to page3, but it become worse: those other data ...disapeared!!! Please take a look at the code:
<pre id=code><font face=courier size=2 id=code>&lt;%@ LANGUAGE = "VBScript"
ENABLESESSIONSTATE = False %&gt;
&lt;%
Option Explicit
On Error Resume Next
Response.Expires = 0
%&gt;
&lt;!-- #include virtual="../../../inc/inc-conexao.asp" --&gt;
&lt;!-- #include virtual="../../../inc/clsDatefunctions.asp" --&gt;
&lt;%
Dim objConn, objRS, strQ, y, i, m, a, n, k, varcodigoind
Dim strConnection
dim date_functions
Call abre_objConn

Set date_functions = new classDateFunctions
Set objRS = Server.CreateObject("ADODB.Recordset"
y = Request.form("valatualiz"
varcodigoind = request.querystring("tit"
Set objRS.ActiveConnection = objConn

strQ = "SELECT TOP 24 indecontb.codigoind, indecontb.mesind, indecontb.anoind, indecontb.numeroind, indecontb.varmesind, indecontb.vardozemesind, indecontb.tipoind FROM indecontb WHERE codigoind LIKE '%" & varcodigoind & "%'"
objRS.Open strQ
%&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;
&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;Contratos on Line &nbsp;:&nbsp; Atualize o valor do seu &nbsp;Contrato conforme o &nbsp;Índice econômico&lt;/TITLE&gt;
&lt;META http-equiv=Content-Type content="text/html; charset=windows-1252"&gt;
&lt;LINK href="../../../inc/estiloCoL.css" type=text/css rel=stylesheet&gt;
&lt;!-- #include virtual = "../inc/scrollbarbranco.css" --&gt;&lt;/head&gt;

&lt;BODY background="../../../imagens/back1.gif" onload="document.calcatualizacao2.valatualiz.focus()"&gt;.....
&lt;FORM&gt;&lt;DIV style="position:absolute; width:526px; top:57px;"&gt;
&lt;%
i = objRS("tipoind"
m = objRS("mesind"
a = objRS("anoind"
n = objRS("numeroind"
k = FormatNumber(objRS("vardozemesind", 4, -1)
%&gt;
Nome do índice: &lt;% = i %&gt;&lt;BR&gt;
Mês/ano a que se refere: &lt;% = m %&gt;/&lt;% = a %&gt;&lt;BR&gt;
Índice respectivo: &lt;% = n %&gt;&lt;BR&gt;
Variação nos últimos 12 meses: &lt;% = k %&gt;&lt;BR&gt;&lt;BR&gt;

Valor contratual atual-k: R$ &lt;% = y %&gt;&lt;BR&gt;
Valor contratual atual-valatualiz: R$ &lt;% = valatualiz %&gt;&lt;BR&gt;
&lt;/FORM&gt;</font id=code></pre id=code>
May You-Gurus be kind in helping me to find this mysterious patch? Thanks, many thanks since now!
Sincelery Dalton

Replies

Replied 02 Jun 2003 00:35:20
02 Jun 2003 00:35:20 Dalton Gilson replied:

Reply to this topic