There is a file sharing violation. A different process might be using the file
Código:
Cualquier sugerencia es bienvenida. Public Sub Conexion()
'Abre una conexion con la base de datos si es que no hay una ya abierta.
Dim connectionString As String
Dim fileName As String = "|DataDirectory|\VetCon2010DB.sdf"
Dim password As String = "vetcon1981"
'string conexion sql server compact
connectionString = String.Format("Persist Security Info = False; DataSource={0}; Password={1}; File Mode = 'shared read';", fileName, password)
Dim conexionSql As New SqlCeConnection(connectionString) 'creo el objeto de conexion
If conexionSql.State = ConnectionState.Closed Then
conexionSql.Open()
MessageBox.Show("conexion establecida")
ElseIf conexionSql.State = ConnectionState.Open Then
conexionSql.Close()
MessageBox.Show("conexion terminada")
End If
End Sub


