Visual Basic - OBJETO ABIERTO O CERRADO

Life is soft - evento anual de software empresarial
 
Vista:

OBJETO ABIERTO O CERRADO

Publicado por pacO (2 intervenciones) el 12/03/2006 12:02:21
hOLA TENGO EL SIGUIENTE CODIGO QUE NO ME DA NINGUN PROBLEMA CUANDO EJECUTO EL FORMULARIO UNA VEZ EL PROBLEMA ES CUANDO CIERRO EL FORMULARIO Y LO VUELVO HA ABRIR ME DICE QUE EL OBJETO CNN YA ESTA ABIERTO, YA SE QUE HACIENDO CNN.CLOSE LO PUEDO ABRIR Y CERRAR MULTITUD DE VECES PERO A MI ESO NO ME INTERESA, ALGUIEN ME PODRIA DECIR COMO ES LA INSTRUCCION PARA SABER SI EL OBJETO CNN ESTA ABIERTO

MUCHAS GRACIAS

'mira si base de datos esta presente
If Dir$(App.Path & "\Bases\General.mdb") <> "" Then
'database alredy present so open it
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Bases\General.mdb"
'set catalog
cat.ActiveConnection = cnn
'open a recordset
rss.Open "select * from Empresas where marca = '*'", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:OBJETO ABIERTO O CERRADO

Publicado por Cecilia Colalongo (3116 intervenciones) el 12/03/2006 13:49:32
Revisa la propiedad State:

If cnn.State = adStateClosed Then
cnn.Open
End If
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:OBJETO ABIERTO O CERRADO

Publicado por pacO (2 intervenciones) el 12/03/2006 15:38:54
Si, muchas gracias cecilia
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar