Return data from cached dataview

  • Thread starter Thread starter Peter Kaufman
  • Start date Start date
P

Peter Kaufman

Hi,

Is it possible to return data using SQL from a dataview cached in
httpcontext.current.cache? If so, what would the connection string
look like?

Thanks,

Peter
 
Are you talking about an object instantiated from a DataView class? If so, I
am not sure how you would do this, as the DataView is largely a filter.
Normally, I would store the underlying DataSet or DataTable, rather than
DataView in cache. This also gives you the flexibility to alter the view, if
necessary, without having to refetch data.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Hi Peter,

You have already an instance of DataView stored in cache?
Then you don't need connection string. Just use that instance.
What exactly means "return data"?
Can you elaborate a bit?
 
Gregory and Miha - thanks -

Sorry if I am not using the right terminology.

I have the dataview (could be dataset or table) in cache. I want to
extract data depending on certain criteria, like "Select * FROM
httpcontext.current.cache("MyCachedDataview") WHERE IDS = 3"

I was trying to do so using a SqlDataAdapter but I would need a
connection string for that, and can't see how else to do it.

Peter
 
Hi Peter,

DataSet is a collection of DataTables (and other metadata).
DataView is a filter view of DataTable.
If you have data already present in datatable and you just want to filter it
then you don't need adapter stuff (not you need any database connection).
Just to clear the terminology. :)

So, if you want to select only rows based on ceratin criteria from a single
DataTable you would:
- create a DataView on that table
- set its RowFilter to match the criteria.

See help on DataView and DataColumn.Expression (for a list of valid
expressions).
 
Back
Top