ghirst
Posts: 5
|
| Posted: 11/07/2014, 3:10 AM |
|
Good day,
I have inherited a website created in Code Charge and spotted that the recordcount always doubles up what is should find and also doubles up the gridview. If I remove the code then nothing is found and if I put "/2" i.e. divide by 2 I get the right number of records but of course only half of them.
I am a bit stuck as there does not appear to be a double loop. For example when I search for a property "12 High Street" there is only one in the PropertyTable and it has 26 references therefor it should show 26 references (if there was 2 references in the main table the error would make sense!)
Thank you in advance.
Code below (Partial)
PARTIAL
###########################################################
###########################################################
###########################################################
<%
'BindEvents Method @1-2F2A52A5
Sub BindEvents(Level)
If Level="Page" Then
Set CCSEvents("BeforeInitialize") = GetRef("Page_BeforeInitialize")
Else
Set TblProperty1.TblProperty1_TotalRecords.CCSEvents("BeforeShow") = GetRef("TblProperty1_TblProperty1_TotalRecords_BeforeShow")
Set TblProperty_TblAsbestos.TblProperty_TblAsbestos_TotalRecords.CCSEvents("BeforeShow") = GetRef("TblProperty_TblAsbestos_TblProperty_TblAsbestos_TotalRecords_BeforeShow")
End If
End Sub
'End BindEvents Method
Function TblProperty1_TblProperty1_TotalRecords_BeforeShow(Sender) 'TblProperty1_TblProperty1_TotalRecords_BeforeShow @548-C35B82E9
'Retrieve number of records @549-3D9B49A1
TblProperty1.TblProperty1_TotalRecords.Value = TblProperty1.DataSource.Recordset.RecordCount
'End Retrieve number of records
End Function 'Close TblProperty1_TblProperty1_TotalRecords_BeforeShow @548-54C34B28
Function TblProperty_TblAsbestos_TblProperty_TblAsbestos_TotalRecords_BeforeShow(Sender) 'TblProperty_TblAsbestos_TblProperty_TblAsbestos_TotalRecords_BeforeShow @969-CA4CC218
'Retrieve number of records @970-18B5D207
TblProperty_TblAsbestos.TblProperty_TblAsbestos_TotalRecords.Value = TblProperty_TblAsbestos.DataSource.Recordset.RecordCount
'End Retrieve number of records
End Function 'Close TblProperty_TblAsbestos_TblProperty_TblAsbestos_TotalRecords_BeforeShow @969-54C34B28
|
 |
 |
eratech
Posts: 513
|
| Posted: 11/08/2014, 12:53 AM |
|
Hi ghirst
A couple of questions - what database are you using (Access, MSSQL, MySQL etc) as that *might* affect it; and secondly, if you go to the Data Source property for the two grids (TblProperty1 and TblProperty_TblAsbestos) and click the 'SQL' tab to get the query to run against the database, do you get the expected results?
Then I would look in the Code for the Open() methods - they usually have the Query and a Count query that might help figuring it out.
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
 |
 |
ghirst
Posts: 5
|
| Posted: 11/10/2014, 8:44 AM |
|
Thanks for the reply.
Using SQL and I get the expected result when directly querying the DB via SQL. (ie 26 not 52 in my example case)
I'll have a dig for the Open() method, all very stage! Last time I found one in legacy code someone had duplicated the code, if only it was all so easy!
|
 |
 |
010hnoor
Posts: 1
|
| Posted: 05/14/2015, 11:41 PM |
|
Retrieve number of records @549-3D9B49A1
TblProperty1.TblProperty1_TotalRecords.Value = TblProperty1.DataSource.Recordset.RecordCount
'End Retrieve number of records
_________________
Pass your [url=http://www.cert-killer.net/70-534-dumps.html]cert killer 70-534[/url].
|
 |
 |
|