Useing OLEDBDataAdapter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Declared a static object variable for OLEDBCommand and OLEDBDataAdapter.
Instantiate both of them. Set the command object to the SelectCommand
property of the OLEDBDataadapter.

Assign the commandtext of the command object. And call the fill function of
the dataadapter. Works fine for several postbacks. But, then for some odd
reason the selectcommand property on the dataadapter changes to null. The
command object that was associated to the selectcommand property is still
valid (not null) as well as the dataadapter object itself. Only the
selectcommand property. Any ideas how that can happen. Not calling any
..Dispose method.
 
Not wise to make database objects static, as the base setup uses an
underlying pool for the connection objects, which, to an extent, cascades
up. As a static variable, everyone shares it, which can be an issue, as
well. I would not store command objects in this manner. Sotring parameter
objects is acceptable, which is what MS does in the block.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside of the box!
*************************************************
 
Back
Top