PDA

View Full Version : Problem with accessing the correct record


Vimal
06-13-2003, 02:25 AM
Hi all..

Can anyone help me plz. I am having a problem accessing the correct records in my DB.

Actually I have a page that displays different account numbers. When I click on an account number, it should direct me to another page where the details for that pariticular account are displayed.

However, instead of getting these particular details, I am getting the details for another account number, and no matter on which account number I click, I continue getting same details for the same account number.

What is also strange is that in the URL of the page, it shows me the correct account number on which I labe clicked.

I feel that there is no problem with my codings (though I might be wrong), and I cant figure out what is the problem. Can anyone help me plz.

Thanks.

Cheers
Vimal

jsawkang
06-13-2003, 02:57 AM
Hi...

mind to post ur code here? the page u put link and also the page u display the record.

1 question, r u record paging for the page u put ur URL?

Vimal
06-13-2003, 03:42 AM
I you want to have a look at the problem, please visit the site:

http://bii.intnet.mu/default1.asp

Username: 123456
Password: sam

Click on 'My Accounts' and choose any Account Number in Time Deposit.


Here is the page that displays details of the account numbers I removed some of the HTML coz the page is too long to be displayed here):

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/biidataconnect.asp" -->

<%
Session("MM_totaldr") = 0
Session("MM_totalcr") = 0
Session("MM_Closbal") = 0
%>

<html>
<head>
<title>Bank Internasional Indonesia</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body bgcolor="#FFFFFF" text="#000000" background="images/bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" >


<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Session("MM_curr") <> "") Then
Recordset1__MMColParam = Session("MM_curr")
End If
%>

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_biidataconnect_STRING
Recordset1.Source = "SELECT * FROM CURRENCY1 WHERE KDMU = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
session("MM_currency") = Recordset1.fields("NAMU")

Recordset1_numRows = 0
%>

<%
Dim query_rktrans__MMColParam
query_rktrans__MMColParam = "1"
If (Session("MM_byet") <> "") Then
query_rktrans__MMColParam = Session("MM_byet")
End If
%>
<%
Dim query_rktrans
Dim query_rktrans_numRows

Set query_rktrans = Server.CreateObject("ADODB.Recordset")
query_rktrans.ActiveConnection = MM_biidataconnect_STRING
query_rktrans.Source = "SELECT NCUS, BYET, VALDAT, DUEDAT, FVAL, CDMU, RATE, JUMINT FROM DEP WHERE BYET = '" + Replace(query_rktrans__MMColParam, "'", "''") + "'"
query_rktrans.CursorType = 0
query_rktrans.CursorLocation = 2
query_rktrans.LockType = 1
query_rktrans.Open()
query_rktrans_numRows = 0
%>

<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
query_rktrans_numRows = query_rktrans_numRows + Repeat1__numRows
%>
<%
MM_Statdate = date() - 1
session("MM_weekday") = weekdayname(weekday(MM_Statdate))
session("MM_day") = day(MM_Statdate)
session("MM_month") = monthname(month(MM_Statdate))
session("MM_year") = year(MM_Statdate)
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID

strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If

On Error Resume Next

If (nLCID > -1) Then
Session.LCID = nLCID
End If

If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If

If (nLCID > -1) Then
Session.LCID = oldLCID
End If

DoDateTime = strRet
End Function
</SCRIPT>

{HTML TEXTS}

<div align="left">
<table width="91%" border="0">
<tr bgcolor="#FFCC00">
<td width="47%"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Value
Date </strong>(dd/mm/yy) <strong><font color="#FF0000"><%= DoDateTime((query_rktrans.Fields.Item("VALDAT").Value), 2, 2057) %></font></strong> </font></td>
<td width="53%" bgcolor="#FFCC00"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Maturity
Date </strong> (dd/mm/yy) <strong><font color="#FF0000"><%= DoDateTime((query_rktrans.Fields.Item("DUEDAT").Value), 2, 2057) %></font></strong></font></td>
</tr>
</table>
</div>
<table width="91%" height="113" border="1">
<tr>
<td height="107">
<table width="97%" border="0">
<tr bgcolor="#00FFFF">
<td width="25%"><div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">Principal
Amount</font></strong></div></td>
<td> <div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">Rate</font></strong></div></td>
<td width="26%"><div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">Interest
Amount</font></strong></div></td>
<td width="24%"><div align="center"><strong><font size="2" face="Arial, Helvetica, sans-serif">Maturity
Value</font></strong></div></td>
</tr>
<tr bgcolor="#00FFFF">
<td><div align="center"><font color="#FF0000" size="2" face="Arial, Helvetica, sans-serif"><strong><%= FormatNumber((query_rktrans.Fields.Item("FVAL").Value), 2, -2, -2, -2) %></strong></font></div></td>
<td> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;<%= FormatNumber((query_rktrans.Fields.Item("RATE").Value), 2, -2, -2, -2) %> % p.a</font></div></td>
<td><div align="center"><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;<%= FormatNumber((query_rktrans.Fields.Item("JUMINT").Value), 2, -2, -2, -2) %></font></div></td>
<%
Mtotal = query_rktrans.Fields.Item("FVAL").Value + query_rktrans.Fields.Item("JUMINT").Value
%>
<td><div align="center"><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;<%= FormatNumber(Mtotal, 2, -2, -2, -2) %></font></div></td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
<td><font size="2" face="Arial, Helvetica, sans-serif">&nbsp;</font></td>
</tr>
</table> </td>
</tr>
</table>
<p>&nbsp; </p>
<p>&nbsp;</p></td>
</tr>
</table>
<table width="768" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="120" height="5" align="center" valign="middle" bgcolor="#000000">
<p><img src="images/transPix.gif" width="24" height="5"></p></td>
<td width="22" valign="middle" bgcolor="#000000">&nbsp; </td>
<td valign="middle" width="551" align="right"> <table width="12" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="12" height="4"> <img src="images/transPix.gif" width="12" height="5"></td>
</tr>
</table></td>
<td valign="top" align="center" width="75"> <img src="images/transPix.gif" width="24" height="5"></td>
</tr>
<tr>
<td width="120" height="24" align="center" valign="middle" bgcolor="#000000">&nbsp;</td>
<td width="22" valign="middle" bgcolor="#000000">&nbsp;</td>
<td valign="middle" align="center"><font class="finePrint"> <font size="1" face="Arial, Helvetica, sans-serif">BANK
INTERNASIONAL INDONESIA - MAURITIUS. Copyright &copy; 2002 <br>
All Rights Reserved.</font></font> </td>
<td valign="middle" align="center"> <img src="images/transPix.gif" width="24" height="5"></td>
</tr>
</table>
<map name="Map2">
<area shape="rect" coords="3,3,103,87" href="https://www.firstib.com" alt="First Internet Bank of Indiana" title="First Internet Bank of Indiana">
</map></td>
<td width="50" height="617"><img src="images/transPix.gif" width="1" height="20"></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
query_rktrans.Close()
Set query_rktrans = Nothing
%>

Kodo
06-14-2003, 12:12 PM
I believe your problem lies in this

query_rktrans.Source = "SELECT NCUS, BYET, VALDAT, DUEDAT, FVAL, CDMU, RATE, JUMINT FROM DEP WHERE BYET = '" + Replace(query_rktrans__MMColParam, "'", "''") + "'"


Your variable BYET, i'm not sure where you are getting it from.
You should be grabbing the value from request.querystring("BYET"), but I'm not seeing this happen.

another friendly tip. Avoid using replace function inside the queries. Any manipulation of a variable should be done before it hits the query. It makes it easier to locate errors and makes the queries look cleaner as well.

Do you plan to put this on a secure sever?

Vimal
06-17-2003, 12:13 AM
Thanks for your help KODO. I replaced my code with the request.querystring("BYET") in the WHERE clause and it worked out fine.

:)

The application is already on a secure server..at least I guess so. Please let me know if I'm wrong.

Cheers,
Vimal