all groups > sql server connect > may 2005 >
You're in the

sql server connect

group:

Connect to SQL server 2005 using SQLDMO


Re: Connect to SQL server 2005 using SQLDMO Ken Tucker [MVP]
5/31/2005 6:13:11 AM
sql server connect:
Hi,

What are you trying to do with sqldmo?

Ken
-----------------
[quoted text, click to view]
Hi all
i need to know if sql dmo can connect to SQL server 2005
if can! how can i do this ??

i have this code

Dim xServer a SQLDMO.Server
......bla..bla...

xServer.LoginSecure = True
xServer.Connect("SQLServer2005")

but it can´t connect.
is there anyother way ??

thks
JSB


Re: Connect to SQL server 2005 using SQLDMO Ken Tucker [MVP]
5/31/2005 7:35:51 AM
Hi,

Use the sp_databases stored procedure to list database names.

Dim strConn As String

Dim conn As SqlConnection

Dim cmd As SqlCommand

Dim dr As SqlDataReader

strConn = "Server =(local);"

strConn &= "Database = ; Integrated Security = SSPI;"

conn = New SqlConnection(strConn)

cmd = New SqlCommand("sp_Databases", conn)

cmd.CommandType = CommandType.StoredProcedure

conn.Open()

dr = cmd.ExecuteReader

If dr.HasRows Then

Do While dr.Read

Trace.WriteLine(String.Format("Name {0} Size {1}", _

dr.Item("Database_Name"), dr.Item("Database_Size")))

Loop

End If

dr.Close()

conn.Close()





Ken

----------------------

[quoted text, click to view]
i just want the get databases listname

thks



[quoted text, click to view]


Connect to SQL server 2005 using SQLDMO João Santa Bárbara
5/31/2005 10:16:01 AM
Hi all
i need to know if sql dmo can connect to SQL server 2005
if can! how can i do this ??

i have this code

Dim xServer a SQLDMO.Server
......bla..bla...

xServer.LoginSecure = True
xServer.Connect("SQLServer2005")

but it can´t connect.
is there anyother way ??

thks
JSB

Re: Connect to SQL server 2005 using SQLDMO João Santa Bárbara
5/31/2005 11:19:35 AM
i just want the get databases listname

thks



[quoted text, click to view]

AddThis Social Bookmark Button