Thread Safety, dataset and dataview, ASP.NET

A

Arthur Dzhelali

I according to MSDN dataview and dataset are thread safe for read
operations, but we run into this scenario. I just would like to see some
comments on it.
Aplication written in VB.NET it is an ASP.NET app.
located on busy web server.

Initially we defined dataview slightly wrong and run into the problem.

we have dataset cached which has large ammount of data.


sub Page_Load()
DisplayMyData()
end sub

Private sub DisplayMyData()
Dim ds as dataset=cache("Mydataset")

'this declaration caused a problem
dim dv as dataview=ds.tables("Mytable").defaultView

dv.rowfilter="My expression"

mydatagrid.datasourse=dv
mydatagrid.databind()
end Sub

ok, now during busy hours we had instead of several items, whole table
binded to datagrid. on refresh it was gone and everything worked fine.

problem was fixed when dataview was defind like this
dim dv as new dataview(ds.tables("Mytable"))


I understend why sometime we had whole table binded to datagrid, probably
when I tried bind dataview to datagrid, someone called that page and
dataview was changed to table.defaultview.

How this can be? dataview is not shared, sub is private
dataset is a shared object. Each user should have its own dataview and
reference to dataset.
 
J

Jon Skeet [C# MVP]

How this can be? dataview is not shared, sub is private
dataset is a shared object. Each user should have its own dataview and
reference to dataset.

No, everyone would be sharing the same DataView because they're all
using the default one for the table in the line:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top