473,699 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page Disappears

HI All,

I am having a problem that is driving me crazy. I have this asp file
which queries three table sin the db and writes the records. That part
is fine (process). The page is sorted in ascending order by a field
inthe db name CYear. The results are crazy. It misses, refuses to pass
or ignores 7 records. By the way which is the equivalentto one page.
The page size is divided into 7 records per page. Also, when is fails
to send the missing records which ARE in the db it doubles some records.
Meaning a record could be on page 1 but it is also showing up on page 3
or a record could be on the bottom of page 4 but it also shows up on the
top of page 5. This thing is KILLING me, please help. The other
aspects of the page work fine. It is just when we added the sortBy
function that it all went crazy. Please help. The page is long but
simple to follow. Any help would be greatly appreciated.



<%@LANGUAGE="JS cript" CODEPAGE="1252" %>

//my connection string. you may use yours instead.
var dbPath,dbName,s Conn, strCN;

//This is your connection string
var sConn = "dsn=thePartyKi dsDB";

//Create Connection
var oConn = Server.CreateOb ject("ADODB.Con nection");
oConn.Open (sConn);

// This is the page number that supplied by the Flash calling this page.
var pageNumber = parseInt(Reques t.Form("pageNum ber"));
//var pageNumber = 2; //comment out

// This is the school that supplied by the Flash calling this page.
var eSName = Request.Form("e SName");
//This is the page size
var pageSize = 7;

//This is your actual query
var tableName = "MemberRegistra tion INNER JOIN (MemberLogin INNER JOIN
MemberPreferenc es ON MemberLogin.MRI D = MemberPreferenc es.MRID) ON
(MemberLogin.MR ID = MemberRegistrat ion.MRID) AND
(MemberRegistra tion.MRID = MemberPreferenc es.MRID)";

//Your field list
var fields = "MemberLogin.MR ID, MemberLogin.UNa me,
MemberRegistrat ion.MRID, \
MemberRegistrat ion.FFName, MemberRegistrat ion.FNName,
MemberRegistrat ion.FLName, \
MemberRegistrat ion.CFName, MemberRegistrat ion.CNName,
MemberRegistrat ion.CLName, \
MemberRegistrat ion.ESName, MemberRegistrat ion.ESYear,
MemberRegistrat ion.MSName, \
MemberRegistrat ion.MSYear, MemberRegistrat ion.HSName,
MemberRegistrat ion.HSYear, \
MemberRegistrat ion.PSName, MemberRegistrat ion.PSYear,
MemberRegistrat ion.CName, \
MemberRegistrat ion.CYear, MemberRegistrat ion.OName,
MemberRegistrat ion.OYear, \
MemberPreferenc es.MRID, MemberPreferenc es.BMonth,
MemberPreferenc es.BDate, \
MemberPreferenc es.MStatus, MemberPreferenc es.NKids,
MemberPreferenc es.Occupation, \
MemberPreferenc es.City, MemberPreferenc es.State \
//your filter clause
var queryFilter = "(((MemberRegis tration.CName)= '" + eSName + "'))"
//Paging query setting
var primaryKey = "MemberRegistra tion.MRID";
var prevString = pageSize * (pageNumber-1);
//optional sorting (didnt use it)
//=============== =============== =============== ===========

var sortField = "MemberRegistra tion.CYear";
var sortDir = "ASC";

//The Paging query

var sSQL = "SELECT (SELECT ((COUNT(*) - 1)/" + pageSize + "+ 1) FROM "
+ tableName + " WHERE " + queryFilter + ") AS PageCount,(SELE CT
COUNT(*) FROM " + tableName + " WHERE " + queryFilter + ") AS
totalCount, " + fields + " \
FROM " + tableName + " \
WHERE " + primaryKey + " IN \
( \
SELECT TOP " + pageSize + " " + primaryKey + " \
FROM " + tableName + " \
WHERE " + queryFilter
if (prevString > 0)
sSQL += " AND " + primaryKey + " NOT IN \
( \
SELECT TOP " + prevString + "
" + primaryKey + " \
FROM " + tableName + " \
WHERE " + queryFilter ;
if ( sortField )
sSQL += " ORDER BY "
+ sortField ;
if ( sortField && sortDir )
sSQL += " " +
sortDir ;
sSQL += " ) " ;
if ( sortField )
sSQL += " ORDER BY " + sortField ;
if ( sortField && sortDir )
sSQL += " " + sortDir ;
sSQL += " ) ";
if ( sortField )
sSQL += " ORDER BY " + sortField ;
if ( sortField && sortDir )
sSQL += " " + sortDir ;

//opening the recordset
var rs = Server.CreateOb ject("ADODB.Rec ordset");
ActiveConnectio n = oConn;
CursorType = 3
CursorLocation = 3;
LockType = 1
Source = sSQL;

var strRW = "&";
//Im not sure if you need the counter now. Do you think that I need the
counter? Would it give me the total number of records or just the total
number on the page?
var numCO = 0;
totalcounter= rs.Fields("tota lCount").Value;
pagecounter= Math.floor(rs.F ields("PageCoun t").Value);

//I can suggest you to get rs fields using: rs.Fields("fiel dName").Value
while( !rs.EOF)
//In JS, the concatenation is done using the +.
strRW += "UName" + numCO + "=" + rs.Fields("UNam e").Value
+ "&BMonth" + numCO + "=" + rs.Fields("BMon th").Value
+ "&BDate" + numCO + "=" + rs.Fields("BDat e").Value
//+ "&BYear" + numCO + "=" + rs.Fields("BYea r").Value
+ "&MStatus" + numCO + "=" + rs.Fields("MSta tus").Value
+ "&NKids" + numCO + "=" + rs.Fields("NKid s").Value
+ "&Occupatio n" + numCO + "=" +
rs.Fields("Occu pation").Value
+ "&City" + numCO + "=" + rs.Fields("City ").Value
+ "&State" + numCO + "=" + rs.Fields("Stat e").Value
+ "&FFName" + numCO + "=" + rs.Fields("FFNa me").Value
+ "&FNName" + numCO + "=" + rs.Fields("FNNa me").Value
+ "&FLName" + numCO + "=" + rs.Fields("FLNa me").Value
+ "&CFName" + numCO + "=" + rs.Fields("CFNa me").Value
+ "&CNName" + numCO + "=" + rs.Fields("CNNa me").Value
+ "&CLName" + numCO + "=" + rs.Fields("CLNa me").Value
+ "&ESName" + numCO + "=" + rs.Fields("ESNa me").Value
+ "&ESYear" + numCO + "=" + rs.Fields("ESYe ar").Value
+ "&MSName" + numCO + "=" + rs.Fields("MSNa me").Value
+ "&MSYear" + numCO + "=" + rs.Fields("MSYe ar").Value
+ "&HSName" + numCO + "=" + rs.Fields("HSNa me").Value
+ "&HSYear" + numCO + "=" + rs.Fields("HSYe ar").Value
+ "&PSName" + numCO + "=" + rs.Fields("PSNa me").Value
+ "&PSYear" + numCO + "=" + rs.Fields("PSYe ar").Value
+ "&CName" + numCO + "=" + rs.Fields("CNam e").Value
+ "&CYear" + numCO + "=" + rs.Fields("CYea r").Value
+ "&OName" + numCO + "=" + rs.Fields("ONam e").Value
+ "&OYear" + numCO + "=" + rs.Fields("OYea r").Value + "&"
//+ "&Total" + numCO + "=" + rs.Fields("tota lCount").Value
// just in case Ive provided that total record count
//+ "&PageCount " + numCO + "=" +
Math.floor(rs.F ields("PageCoun t").Value) + "&" //the page count that
you need in your Flash
//+ "&Article" + numCO + "=" + rs.Fields("Arti cle").Value +
//screen test can I take the line breaks out
//Response.Write( strRW);

//I don't think that you need the tot now, since it will alwase show the
page size - see line 94?
Response.Write( strRW + "tot=" + numCO + "&"+"tCount er=" + totalcounter +
"&" + "pCounter=" + pagecounter);

rs = null;

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 22 '05 #1
0 1130

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Martin Zuber | last post by:
Hello, I have found following problem: When I define event handler for EVT_NOTEBOOK_PAGE_CHANGED for wxNotebook, the content of the wxNotebook disappears (on all pages). For ex. I have two pages - one with some wxTextCtrls, second with some wxGrid. The dialog has been created using the Boa Constructor (0.2.3 and 0.2.7). I have two files: - SomeDialog.py - there is only look and events defined (we can say it
by: Les Juby | last post by:
I'm trying to print a simple catalogue of products but where an image straddles a page break, the image either disappears completely or else the first half prints at the bottom of the page but the second half does not print at the top of the following page.? Huh.? The single image for each record is contained inside of a table with a simple construct. No rowspans just an ordinary <td> placement. The output can be viewed at:
by: | last post by:
hi, selected items in check box disappears when submit button is clicked on aspx page. check box is pasted on .ascx page and which is pasted on aspx page any ideals cheers sam
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
by: Maxim Izbrodin | last post by:
Hello For displaying page titles for my ASP.NET applications I use the following technique <title><%=BannerModule.PageTitle%></title where BannerModule.PageTitle is a public field of my user control. This field is initialized in Page_Load of every my page. This technique works with the exception that the title disappears every time a page is posted back. Could somebody explain me the reason, or suggest a better technique for setting page...
by: Robert Zurer | last post by:
When I click a Button server control I want two things to happen. The server returns a string array of error messages. A Javascript alert appears showing the errors. I can do this using the following method public void ShowErrorWindow(string errors) { string alertString = null;
by: Goober | last post by:
I have the following default.aspx page that works properly. However, what I want to do is to link the graphics within it (that are hard coded now in the default web page) to our corporate website, which has the same graphics rotated on a 30 day basis or so. They have a standard naming convention where I know the 3 graphics are always going to be fa_mmyy.jpg, am_mmyy.jpg, and ax_mmyy.jpg. The HTML follows:
by: Antonio | last post by:
I would like to create a FAQ feature for my web page that populates from a table in the sql server. My table would have a column for a question and one for answer. On the web page I would like to only show the questions listed and when the user clicks the question javascript would expand the answer below it. Then if they click the question the answer disappears again. How do I do the javascript part and fill it with the data from the...
by: Vishal Gupta | last post by:
Hi all, I have a placeholder control on an ASPX page. I dynamically add a few button control and label control to the placeholder from code - all is well with the world. But on post back the control disappears from the placeholder. Am I missing something here Please help
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.