Sometimes you need t-sql to find current database name. Current database name is returned using the following t-sql statement:
SELECT DB_NAME() as CurrentDatabaseName
In order to use current database name you usually need to use IF logic. Below is T-SQL statement example
IF (SELECT DB_NAME())='master'
PRINT 'Error: Select database name from the drop down box which is not master'
PRINT 'Valid Database Name selected'
Hope that helps!