Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AccessDataSource not refreshing..

Status
Not open for further replies.

ZmrAbdulla

Technical User
Apr 22, 2003
4,364
AE
I have a datalist populated from an "AccessDataSource". It should pick a random record. If I run the query itself it works fine as it should be. But when populates it brings up only the same record.
SQL of it is
Code:
SELECT
  TOP 1 Rnd([RecID]) AS Rec
  , tblProverbs.Proverb
  , tblProverbs.Source 
FROM
  tblProverbs 
ORDER BY
  Rnd([RecID])

RecID is an Autonumber field.

anyone having a clue what happens?

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
The AccessDataSource may be performing some kind of caching. Is there any particular reason you are using this control?


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
What are you using to display the data? Gridview?
Regardless try to databind your control on an event.
Like on accessdatasource.selected gridview1.databind
 
I also feel it as a cache in AccessDataSource.

There is no particular reason I am using this control. Since I am more comfortable with Access than SQL Server I am using this. I may chage everything to SQL server later.

How could I remove the data from the cache? It is the Access datasource that keeping the data in memory. I have tried another controls like Gridview and Detailsview that too bring the same result.

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Sometimes the DataSource controls can be "bloated" and it's quite hard to figure out what is going on inside them (such as with this problem). Instead, I find it easier to create my own Data Layer and then at least you can step through the code. Although you are using an Access database, this example shows you how you can get the information from a SQL Server database. You could easily modify the example (any reference to SQL or SQLClient just change to the OleDb class) and get the information into a DataTable. Then, you just need to bind your DataList to the DataTable.

This approach will give you a lot more control over your data and makes it easier to debug problems.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Thanks Mark,
I'll have a test on saturday.

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Mark, It has been solved by taking your code. Working fine now.
Another
star.gif
.

Thanks.

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top