Arrancar instancia

23/04/2004 - 11:56 por fegor | Informe spam
Tengo una instalación de aplicación que instala antes una instancia de
MSDE2000A pero al intentar inicializar el "servicio" da errores. La primera
vez (recién instalado) da error, la segunda funciona, pero si paro el
servicio ya no vuelve a funcionar... ??

El código que uso en la función miembro de mi clase es el siguiente:

El valor de las variables es:

strInstancia = ".\PRUEBA"
strServidor = "(LOCAL)\PRUEBA"
strUsuario = "sa"
strClave = ""

El objeto SQLServer (DMO) es oSQLServer.

Y el error aparece siempre en el método "Start"


Public Sub Iniciar()

On Error GoTo Problema


'##########################################################################
'# Si existe el objeto, se inicializa... si no daría error...
#

'##########################################################################

If Not oSQLServer Is Nothing Then
oSQLServer.Disconnect
Set oSQLServer = Nothing
End If


'##########################################################################
'# Se intenta la identificación... si no (error) se inicia el servicio
#

'##########################################################################

Dim blnConectado As Boolean
Set oSQLServer = New SQLDMO.SQLServer

With oSQLServer
.Start True, strInstancia
.LoginTimeout = 30
.Connect strServidor, strUsuario, strClave
End With

Salida:
blnConectado = oSQLServer.VerifyConnection
If blnConectado = False Then
MsgBox "No ha podido establecerse conexión con la base de datos.",
vbCritical, "Error"
End
End If
Exit Sub

Problema:
If Err.Number = -2147023840 Or Err.Number = 1056 Or Err.Number = 440
Then
With oSQLServer
.LoginTimeout = 30
.Connect strServidor, strUsuario, strClave
End With
Else
MsgBox Err.Number & "; " & Err.Description, vbCritical, "Error"
End
End If

End Sub


Saludos,
Fegor
 

Leer las respuestas

#1 Maximiliano D. A.
23/04/2004 - 14:17 | Informe spam
Hola, y el errror que te da cual es?

Suerte


Salu2
Maxi

Buenos Aires Argentina
Desarrollador Microsoft 3 Estrellas .NET

MSN:
Nunca consideres el estudio como una obligación sino como
una oportunidad para penetrar en el bello y maravillosos
mundo del saber.
- Albert Einstein



"fegor" escribió en el mensaje
news:
Tengo una instalación de aplicación que instala antes una instancia de
MSDE2000A pero al intentar inicializar el "servicio" da errores. La


primera
vez (recién instalado) da error, la segunda funciona, pero si paro el
servicio ya no vuelve a funcionar... ??

El código que uso en la función miembro de mi clase es el siguiente:

El valor de las variables es:

strInstancia = ".\PRUEBA"
strServidor = "(LOCAL)\PRUEBA"
strUsuario = "sa"
strClave = ""

El objeto SQLServer (DMO) es oSQLServer.

Y el error aparece siempre en el método "Start"


Public Sub Iniciar()

On Error GoTo Problema





'##########################################################################
'# Si existe el objeto, se inicializa... si no daría error...
#




'##########################################################################

If Not oSQLServer Is Nothing Then
oSQLServer.Disconnect
Set oSQLServer = Nothing
End If





'##########################################################################
'# Se intenta la identificación... si no (error) se inicia el servicio
#




'##########################################################################

Dim blnConectado As Boolean
Set oSQLServer = New SQLDMO.SQLServer

With oSQLServer
.Start True, strInstancia
.LoginTimeout = 30
.Connect strServidor, strUsuario, strClave
End With

Salida:
blnConectado = oSQLServer.VerifyConnection
If blnConectado = False Then
MsgBox "No ha podido establecerse conexión con la base de datos.",
vbCritical, "Error"
End
End If
Exit Sub

Problema:
If Err.Number = -2147023840 Or Err.Number = 1056 Or Err.Number = 440
Then
With oSQLServer
.LoginTimeout = 30
.Connect strServidor, strUsuario, strClave
End With
Else
MsgBox Err.Number & "; " & Err.Description, vbCritical, "Error"
End
End If

End Sub


Saludos,
Fegor







Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.661 / Virus Database: 424 - Release Date: 19/04/2004

Preguntas similares