Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 retrieve list of databases from .net

Author  Topic 

j-in-nz
Starting Member

17 Posts

Posted - 2006-12-14 : 21:11:26
Hi,

How do I get a list of sql 2005 express databases from my .net 1 application? Must be in the similar fashion as sqldmo.

jhermiz

3564 Posts

Posted - 2006-12-14 : 21:19:16
quote:
Originally posted by j-in-nz

Hi,

How do I get a list of sql 2005 express databases from my .net 1 application? Must be in the similar fashion as sqldmo.



You can try calling a stored procedure with this code:

use master
select name from sysdatabases

Jon


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]

RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page

j-in-nz
Starting Member

17 Posts

Posted - 2006-12-17 : 15:01:15
Actually I want to get to one level higher than that. I want the user to select a server, then a db, then they should enter login details and click connect. I know u can do this with sqldmo but that is only for sql 2000. Any other help?
thanks
Go to Top of Page

jhermiz

3564 Posts

Posted - 2006-12-18 : 08:46:55
The DMO object model works with 2005 as well
Set a rerefence to the sql dmo lib and use below code (this should be under the COM tab)

Dim sqlObj As New SQLDMO.Application

With sqlObj.ListAvailableSQLServers()

For i As Integer = 0 To .Count

MsgBox(.Item(i))

Next

End With


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]

RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page
   

- Advertisement -