database - Microsoft Enterprise Library Connection String -


hi i've got data out of database instance shown in code. how database name database instance. can't find properties regarding this. please help.

private database _db = enterpriselibrarycontainer.current.getinstance<database>("connstring"); 

there no explicit property this, because database database technology independent class, , concept of "database name" db specific. heck, things sqlite or sqlce don't have "database names", filenames.

you can use "_db.connectionstring" connection string out , parse through if know type of database. each ado.net provider includes connection string builder class parsing you.

for example, if have ms sql connection string, can database name way:

var connectionstringbuilder = new sqlconnectionstringbuilder(_db.connectionstring); string databasename = connectionstringbuilder.initialcatalog; 

different database providers of course use different properties , terminology give information.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -