471,354 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

using intellisense to pull data from a database

I have a series of class libraries. Some of the functions require string
constants to be passed in in order to effect certain behavior. Over time the
list of strings that could be passed in grew rather large and developers
often made mistakes by typing the wrong string in. I converted the string to
be numbers and started using enums. That way the developer just references
the appropriate assembly and then intellisense offers a drop-down of the
appropriate enum. Looks like this:

<top class>.customErrors.ERR_DATAACCESS_CONNECTIONMANAG ER

<top class>.customErrors.ERR_FILEACCESS_INIFILEREADER

<top class>.customErrors.ERR_GENERIC_LIBRARY_ERROR

etc - you get the idea. They get passed into a function that can act on it
appropriately by quering the database for the corresponding string value.
The problem is that the number of possible entries grows and then I have to
add it to the enum list and recompile.

My question - is there a way to simulate something similiar but allow the
enum values to query from a list of table values in a database? Obviously
this wouldn't be an enum anymore. Basically I just want the developer to be
able to type: foobar.customErrors.<dynamic list> and then rather than a
static list of values it would pull from a database.

Make sense? Any ideas?

Thanks,

- Jeff


Jul 21 '05 #1
0 975

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Julia Baresch | last post: by
5 posts views Thread by junglist | last post: by
2 posts views Thread by Jeremy Dillinger | last post: by
reply views Thread by Jeff Patrick | last post: by
6 posts views Thread by tshad | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.