|
-
Aug 15th, 2001, 07:35 PM
#1
Thread Starter
Lively Member
Displaying only the last 5 day's records.
Hi everyone,
I use the data grid to display the records from a sybase database. The problem is the user has 1000's of records to display, which takes a lot of time.
They want to see only the last few day's transactions.
How can I set up the Adodc control to display only the last 10 reocrds or only last few days records?
How can I set up the record source of the Adodc control, some thing like this,
Select * from tblInvoice where Trx_date between today and 5 days before today.
or
Select only the last 10 records from tblInvoice.
Any help is greatly appreciated.
Thank you.
sincerely,
rathi
-
Aug 15th, 2001, 08:37 PM
#2
Hyperactive Member
DO you have anything (Field) in the Table to indicate the date, like a time stamp field or date added field. If so you can make the RecordSource of the ADODC to something like...
SELECT * FROM T_OBJECT WHERE TimeStamp > '2000/11/08'
If not then you can use the SQL TOP keyword...
SELECT TOP 10 * FROM T_OBJECT
Or you can return a Percentage of the records...
SELECT TOP 10 PERCENT * FROM T_OBJECT
-
Aug 15th, 2001, 09:48 PM
#3
PowerPoster
Or use SQL's between method!
Data1.RecordSource = "SELECT table1.* FROM table1 WHERE table1.date BETWEEN date And date2"
Or something similar!
-
Aug 15th, 2001, 09:56 PM
#4
Thread Starter
Lively Member
Thank you.
HI,
Thanks for your reply.
I used the follwoing query,
Select Top 10 Trx_Date, Receipt_No, Payer_Code, Trx_Amount from v_receipt_hdr
Where Company_id = 3708
ORDER BY Trx_date desc
Now, I can display the latest 10 records.
sincerely,
rathi
-
Aug 15th, 2001, 10:01 PM
#5
Thread Starter
Lively Member
More details, please
Hi,
I can use the
Select * from tblInvoice where trx_date between date1 and date2.
Here date1 is today, date 2 is 5 days before today.
How can calculate the date 2? Is there any function to do this?
Pls. reply if you have any idea.
sincerely,
rathi
-
Aug 15th, 2001, 10:12 PM
#6
PowerPoster
To do it simply you could get the user to input it!
If you want todays date just type Date in the sql!
Date2 just type Date - 5!
I.e msgbox Date - 5
Dim date2 as string
date2 = Date - 5
Select * from tblInvoice where trx_date between Date and date2.
-
Aug 16th, 2001, 04:09 AM
#7
Addicted Member
Hi all,
this is the code I normally use to return the last so many days of Information, hope its of use to someone.
Colin
select * from MyLeave where MyDate > getdate() -14
It uses the current system time to return all records input within the last 14 days. Usefull when you want to return more than a fixed number of records.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|