Showing posts with label codedim. Show all posts
Showing posts with label codedim. Show all posts

Friday, February 10, 2012

Connect to SQL server 2005 using SQLDMO

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 cant connect.
is there anyother way ?
thks
JSB
Hi,
What are you trying to do with sqldmo?
Ken
"Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
news:OA1xjFcZFHA.3400@.tk2msftngp13.phx.gbl...
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 cant connect.
is there anyother way ?
thks
JSB
|||i just want the get databases listname
thks
"Ken Tucker [MVP]" <vb2ae@.bellsouth.net> wrote in message
news:%23cgSblcZFHA.3280@.TK2MSFTNGP09.phx.gbl...
> Hi,
> What are you trying to do with sqldmo?
> Ken
> --
> "Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
> news:OA1xjFcZFHA.3400@.tk2msftngp13.phx.gbl...
> 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 cant connect.
> is there anyother way ?
> thks
> JSB
>
>
|||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
"Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
news:OWYlApcZFHA.3164@.TK2MSFTNGP09.phx.gbl...
i just want the get databases listname
thks
"Ken Tucker [MVP]" <vb2ae@.bellsouth.net> wrote in message
news:%23cgSblcZFHA.3280@.TK2MSFTNGP09.phx.gbl...
> Hi,
> What are you trying to do with sqldmo?
> Ken
> --
> "Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
> news:OA1xjFcZFHA.3400@.tk2msftngp13.phx.gbl...
> 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 cant connect.
> is there anyother way ?
> thks
> JSB
>
>

Connect to SQL server 2005 using SQLDMO

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 cant connect.
is there anyother way '
thks
JSBHi,
What are you trying to do with sqldmo?
Ken
--
"Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
news:OA1xjFcZFHA.3400@.tk2msftngp13.phx.gbl...
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 cant connect.
is there anyother way '
thks
JSB|||i just want the get databases listname
thks
"Ken Tucker [MVP]" <vb2ae@.bellsouth.net> wrote in message
news:%23cgSblcZFHA.3280@.TK2MSFTNGP09.phx.gbl...
> Hi,
> What are you trying to do with sqldmo?
> Ken
> --
> "Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
> news:OA1xjFcZFHA.3400@.tk2msftngp13.phx.gbl...
> 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 cant connect.
> is there anyother way '
> thks
> JSB
>
>|||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
"Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
news:OWYlApcZFHA.3164@.TK2MSFTNGP09.phx.gbl...
i just want the get databases listname
thks
"Ken Tucker [MVP]" <vb2ae@.bellsouth.net> wrote in message
news:%23cgSblcZFHA.3280@.TK2MSFTNGP09.phx.gbl...
> Hi,
> What are you trying to do with sqldmo?
> Ken
> --
> "Joo Santa Brbara" <joaosb@.i24portugal.com> wrote in message
> news:OA1xjFcZFHA.3400@.tk2msftngp13.phx.gbl...
> 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 cant connect.
> is there anyother way '
> thks
> JSB
>
>