|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
database name in SqlException?Hi,
I searched around in SqlException, but couldn't find the name of the database in question after catching a SqlException. It isn't SqlException.Server, which has the database *server* name. Anyone know where I can find the database name? Thanks in advance Don't you know which database you are connected to?
-- Show quoteMiha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ <bdgr***@pacbell.net> wrote in message news:1162508842.599881.268780@m73g2000cwd.googlegroups.com... > Hi, > > I searched around in SqlException, but couldn't find the name of the > database in question after catching a SqlException. It isn't > SqlException.Server, which has the database *server* name. Anyone know > where I can find the database name? > > Thanks in advance > Miha Markic [MVP C#] wrote:
> Don't you know which database you are connected to? I'm writing something to look at numerous SqlExceptions across a large> codebase, from different areas of code. So, the exceptions could be happening on any number of different databases. Hi,
Ah, ok, I see. I couldn't find database name, either. As a workaround you could wrap all calls to database in try/catch block (I guess you have to already) and in catch block create your SqlException derived exception that will hold additional database property. -- Show quoteMiha Markic [MVP C#, INETA Country Leader for Slovenia] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ <bdgr***@pacbell.net> wrote in message news:1162593925.960528.166840@m7g2000cwm.googlegroups.com... > Miha Markic [MVP C#] wrote: >> Don't you know which database you are connected to? >> > > I'm writing something to look at numerous SqlExceptions across a large > codebase, from different areas of code. So, the exceptions could be > happening on any number of different databases. > Miha Markic [MVP C#] wrote:
> Hi, There's a wrapper with database name now, I just thought I'd check if> > Ah, ok, I see. I couldn't find database name, either. > As a workaround you could wrap all calls to database in try/catch block (I > guess you have to already) and in catch block create your SqlException > derived exception that will hold additional database property. it's somewhere in SqlException, in case someone bypasses the wrapper. But, if it isn't in there, it isn't in there ;) Thanks for checking, and for the replies. |
|||||||||||||||||||||||