Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS SQL Server & Database names through TQuery

Status
Not open for further replies.

decaderaj

Programmer
Nov 28, 2010
1
US
Hello,

Our application is using Delphi 6 & MS SQL Server 2005. I connect to the database using ODBC. I need to display the SQL Server and the database name on one of the forms. I tried this query, "SELECT @@SERVERNAME SEVERNAME, db_name() DBNAME", using a TQuery component. The query opens fine and BOF <> EOF is true after opening the query. However, when I try to read Fields[0].AsString, it doesn't have any fields.

Please let me know if I can do this through TQuery. If not, what other ways I can use to get the SQL Server name and its database name.

Thanks,
Raj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top