[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Getting database names from a server using LINQ

Posted on 2010-03-30
9
Medium Priority
?
346 Views
Last Modified: 2012-05-09
How can I get the database names from my server using LINQ, since server does not save any table so I can create common share entity  table<> to map.
0
Comment
Question by:Masterabhi
  • 3
  • 3
7 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 29120987
I know how to retrieve the list of databases in MySQL query:
http://dev.mysql.com/doc/refman/5.1/en/show-databases.html

however, not sure if that can be "translated" into LINQ...
0
 

Author Comment

by:Masterabhi
ID: 29748434
I am sorry this didn't work, but I figured it out though.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 29793266
could you please share the solution?
and then close the question accordingly!
a3
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 

Author Comment

by:Masterabhi
ID: 29920521
I am afraid to say that I am not using LINQ in that just because of time constraint of my application to be done. so I used old way to  get access from master database.
SELECT * FROM master.sys.databases.
Using LINQ i was wondering how am I going to manage the entity table which should be same as in database table. but  database names are not stored in master as tables. I believe they are saved as directories.
So if you find out the way to do that please let me know.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 29924676
>SELECT * FROM master.sys.databases.
this is MS SQL Server, right?

while MySQL indeed creates a folder per database, the list is still available in the information_schema views ...

in MySQL, the "database" is actually referred to as schema:
http://dev.mysql.com/doc/refman/5.0/en/schemata-table.html

while the same view exists in MS SQL Server, there it referes to the SCHEMA of the selected database.
the list of databases is indeed available in master.sys.databases (sql 2005+) or master.dbo.sysdatabases (sql 2000-)
http://msdn.microsoft.com/en-us/library/ms178534.aspx
0
 

Author Comment

by:Masterabhi
ID: 32629066
Thanks.
0
 

Accepted Solution

by:
ee_auto earned 0 total points
ID: 33820659
Question PAQ'd, 500 points refunded, and stored in the solution database.
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question