
August 22nd, 2003, 02:04 PM
|
|
Junior Member
|
|
Join Date: Aug 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
OleDbDataReader, I just want an empty one
sounds strange, i want to create an empty OleDbDataReader, but the contructors are private, so ... i can't
why would i want to do this? well, i'm working on a large application and i'm charged with making the interface smooth. the problem is that the low-level programmers created many (many) controls that make up the app. Many of the controls make calls to the database in their constructors, so in design-mode i open a control, or form, and those constructors get called, but the db is not available at design time so an exception is thrown, and all i see is that error message, and not the interface editor of the the control/form. making it difficult to beautify.
my solution was to deflect database calls at the source, go to the db layer interface and if it's in design-mode (i have flags that indicate this) just return "data" that the controls want to see, to make them shut up so i can operate. basically, so the Open()'s return true and ExecuteQuery()'s return ... an EMPTY OleDbDataReader (but i can't) kind of just assuage the controls into thinking they're talking to a database when they're not.
going into each control and wrapping a if(!base.DesignMode){} block around the unsafe stuff would be ideal, but also time consuming, this was supposed to be a quick fix (and you know how those usually work out..)
ideas? thanks!
--
Brian
|