Mattersphere Developers Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Heather@FootAnstey
Posts : 57
Join date : 2018-12-19

C# Questions: How can I display the current database name through code? Empty C# Questions: How can I display the current database name through code?

Sat 18 Apr 2020 - 12:19
Original Post: Liam 24/11/2009 12:51:29

"I am trying to display the database I am connected to in a multi database environment. I have used the following code: FWBS.OMS.UI.Windows.MessageBox.Show(CurrentSession.CurrentDatabase.DatabaseName.ToUpper());
For an example I have just created a button which displays the database name in a message box and the code is on the event 'Click'. This is prompted with the error:
“The software application component is not authorised to access critical data “Database Settings” due to its protection level.” Is there any way to define the protection level or to just display the database name which I am connected to?
This behaviour mirrors the Matter Centre 'about' screen but just trying to expose the database name function."

Responses:

Graham Shaw (BJ) 24/11/2009 12:54:07
"Hi, We do this by creating a datalist that returns db_name()
G"
Back to top
Permissions in this forum:
You cannot reply to topics in this forum