Pregunta sobre sistema Multiusuario
Quisiera saber como tengo que hacer con ADO sin data control para que mi sistema al detectar que esta siendo accedido por otro usuario muestre un mensaje.
Te paso de nuevo mi código en el que declaro como optimista a mi sistema
'Declaraciones publicas de la base de datos y tablas
Public cnSistemaFlowers As ADODB.Connection
Public rstCliente As ADODB.Recordset
Public rstFacturas As ADODB.Recordset
Public rstProductos As ADODB.Recordset
Public rstRubros As ADODB.Recordset
Public rstRubrosProductos As ADODB.Recordset
Public rstProvincia As ADODB.Recordset
Public rstLocalidad As ADODB.Recordset
Public rstRespIva As ADODB.Recordset
Public rstDatosEmpresa As ADODB.Recordset
Public rstFVentaPago As ADODB.Recordset
Public rstDetalleFactura As ADODB.Recordset
Public rstTipoOperac As ADODB.Recordset
Public rstUsuarios As ADODB.Recordset
Public rstProveedores As ADODB.Recordset
Public rstEstadoFactura As ADODB.Recordset
Public rstCompras As ADODB.Recordset
Public rstDetalleCompra As ADODB.Recordset
Public rstGraficoCompra As ADODB.Recordset
Public rstTipoFactura As ADODB.Recordset
Public rstTipodeUsuario As ADODB.Recordset
Public P As Integer
Public F As Integer
Public MontoTotal As Double 'Monto Total de Factura
Public n As Integer
Public Fuente As StdFont
Public Texto As String
Public DetalleFactura As String
Public FF As Integer
Public ValorFila As Integer
Public MontoTotalCompra As Single 'Monto Total de Compra
Public CodProveedor As Integer 'CodProveedor para rstCompras
Public CodTipoPago As Integer 'CodTipoPago para rstCompras
Public AgregarStock As Integer 'Cantidad Agregada al Stock
Public RestarStock As Integer 'Cantidad Restada al Stock
Public StockActual As Integer 'Cantidad Actual del Stock
Public Num_DetCompra As Integer 'Numero del detalle de compra
Public NombreUsuario As String
Public ConvertirNU As String
Public NumeroCompra As String 'Numero de la compra a los proveedores
Public GuardarCantidad As Integer
Public NuevaCantidad As Integer
Public NombProducto As String
Public kkl As Integer
Public GTipoFactura As String * 1
Public ResponsableIva As String
Public Iva As Double
Public agr As Integer
Public ContadorEntradas As Integer
Public CodTipoUsuario As Integer
Sub Main()
On Error GoTo Falla 'control de errores en tiempo de ejecucion
'Crea Instancias y Conecta Abre la Base de Datos
Const sPathBase As String = "c:\Tesis Gris\BDFlowers\SistemaFlowers.mdb"
Set cnSistemaFlowers = New ADODB.Connection
Set rstCliente = New ADODB.Recordset
Set rstProvincia = New ADODB.Recordset
Set rstLocalidad = New ADODB.Recordset
Set rstRespIva = New ADODB.Recordset
Set rstDatosEmpresa = New ADODB.Recordset
Set rstFacturas = New ADODB.Recordset
Set rstProductos = New ADODB.Recordset
Set rstRubrosProductos = New ADODB.Recordset
Set rstRubros = New ADODB.Recordset
'Set rstFVP = New ADODB.Recordset
Set rstFVentaPago = New ADODB.Recordset
Set rstDetalleFactura = New ADODB.Recordset
Set rstTipoOperac = New ADODB.Recordset
Set rstUsuarios = New ADODB.Recordset
Set rstCompras = New ADODB.Recordset
Set rstProveedores = New ADODB.Recordset
Set rstEstadoFactura = New ADODB.Recordset
Set rstDetalleCompra = New ADODB.Recordset
Set rstGraficoCompra = New ADODB.Recordset
Set rstTipoFactura = New ADODB.Recordset
Set rstTipodeUsuario = New ADODB.Recordset
With cnSistemaFlowers
.Provider = "ADODB"
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sPathBase & ";"
.Open
.CursorLocation = adUseClient
End With
'Abrir el conjunto de registros
RstCliente. Open "SELECT * FROM Clientes ", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstFacturas. Open "SELECT * FROM Facturas", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstProductos. Open "SELECT * FROM Productos", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstRubros.Open "SELECT * FROM Rubros_Productos_SF", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstRubrosProductos.Open "SELECT * FROM Rubros_Productos_SF", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstProvincia. Open "SELECT * FROM Provincia", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstLocalidad. Open "SELECT * FROM Localidad", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstRespIva. Open "SELECT * FROM Responsable_Iva", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstDatosEmpresa. Open "SELECT * FROM DatosEmpresa", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstDetalleFactura. Open "SELECT * FROM Detalle_Factura", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstFVentaPago. Open "SELECT * FROM F_VP", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstTipoOperac.Open "SELECT * FROM Tipos_Operaciones_Audit", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstUsuarios. Open "SELECT * FROM Usuarios ORDER BY Usuarios.Nombre_Usuario", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstCompras.Open "SELECT * FROM Compras_A_Proveed", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstProveedores. Open "SELECT * FROM Proveedores", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstEstadoFactura. Open "SELECT * FROM Estado_Factura", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstDetalleCompra. Open "SELECT * FROM Detalle_Compra", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstGraficoCompra. Open "SELECT Mes, Año, MontoTotal FROM GraficoCompra WHERE Año Between #1-1-2002# and #12-31-2002# ", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstTipoFactura. Open "SELECT * FROM TipoFactura", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstTipodeUsuario.Open "SELECT * FROM Tipos_Usuarios", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
'Ruta de acceso
ChDir App.Path
On Error GoTo 0 'detiene el control de errores
Falla: 'instruccion del mensaje de error
If Err.Number = Falla Then Exit Sub
MsgBox "Problemas con la Base de Datos, por favor verifique!!!", vbCritical, "ERROR"
Set cnSistemaFlowers = Nothing
Err.Clear
End Sub
No se en que lugar poner ese mensaje,
Te paso de nuevo mi código en el que declaro como optimista a mi sistema
'Declaraciones publicas de la base de datos y tablas
Public cnSistemaFlowers As ADODB.Connection
Public rstCliente As ADODB.Recordset
Public rstFacturas As ADODB.Recordset
Public rstProductos As ADODB.Recordset
Public rstRubros As ADODB.Recordset
Public rstRubrosProductos As ADODB.Recordset
Public rstProvincia As ADODB.Recordset
Public rstLocalidad As ADODB.Recordset
Public rstRespIva As ADODB.Recordset
Public rstDatosEmpresa As ADODB.Recordset
Public rstFVentaPago As ADODB.Recordset
Public rstDetalleFactura As ADODB.Recordset
Public rstTipoOperac As ADODB.Recordset
Public rstUsuarios As ADODB.Recordset
Public rstProveedores As ADODB.Recordset
Public rstEstadoFactura As ADODB.Recordset
Public rstCompras As ADODB.Recordset
Public rstDetalleCompra As ADODB.Recordset
Public rstGraficoCompra As ADODB.Recordset
Public rstTipoFactura As ADODB.Recordset
Public rstTipodeUsuario As ADODB.Recordset
Public P As Integer
Public F As Integer
Public MontoTotal As Double 'Monto Total de Factura
Public n As Integer
Public Fuente As StdFont
Public Texto As String
Public DetalleFactura As String
Public FF As Integer
Public ValorFila As Integer
Public MontoTotalCompra As Single 'Monto Total de Compra
Public CodProveedor As Integer 'CodProveedor para rstCompras
Public CodTipoPago As Integer 'CodTipoPago para rstCompras
Public AgregarStock As Integer 'Cantidad Agregada al Stock
Public RestarStock As Integer 'Cantidad Restada al Stock
Public StockActual As Integer 'Cantidad Actual del Stock
Public Num_DetCompra As Integer 'Numero del detalle de compra
Public NombreUsuario As String
Public ConvertirNU As String
Public NumeroCompra As String 'Numero de la compra a los proveedores
Public GuardarCantidad As Integer
Public NuevaCantidad As Integer
Public NombProducto As String
Public kkl As Integer
Public GTipoFactura As String * 1
Public ResponsableIva As String
Public Iva As Double
Public agr As Integer
Public ContadorEntradas As Integer
Public CodTipoUsuario As Integer
Sub Main()
On Error GoTo Falla 'control de errores en tiempo de ejecucion
'Crea Instancias y Conecta Abre la Base de Datos
Const sPathBase As String = "c:\Tesis Gris\BDFlowers\SistemaFlowers.mdb"
Set cnSistemaFlowers = New ADODB.Connection
Set rstCliente = New ADODB.Recordset
Set rstProvincia = New ADODB.Recordset
Set rstLocalidad = New ADODB.Recordset
Set rstRespIva = New ADODB.Recordset
Set rstDatosEmpresa = New ADODB.Recordset
Set rstFacturas = New ADODB.Recordset
Set rstProductos = New ADODB.Recordset
Set rstRubrosProductos = New ADODB.Recordset
Set rstRubros = New ADODB.Recordset
'Set rstFVP = New ADODB.Recordset
Set rstFVentaPago = New ADODB.Recordset
Set rstDetalleFactura = New ADODB.Recordset
Set rstTipoOperac = New ADODB.Recordset
Set rstUsuarios = New ADODB.Recordset
Set rstCompras = New ADODB.Recordset
Set rstProveedores = New ADODB.Recordset
Set rstEstadoFactura = New ADODB.Recordset
Set rstDetalleCompra = New ADODB.Recordset
Set rstGraficoCompra = New ADODB.Recordset
Set rstTipoFactura = New ADODB.Recordset
Set rstTipodeUsuario = New ADODB.Recordset
With cnSistemaFlowers
.Provider = "ADODB"
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sPathBase & ";"
.Open
.CursorLocation = adUseClient
End With
'Abrir el conjunto de registros
RstCliente. Open "SELECT * FROM Clientes ", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstFacturas. Open "SELECT * FROM Facturas", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstProductos. Open "SELECT * FROM Productos", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstRubros.Open "SELECT * FROM Rubros_Productos_SF", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstRubrosProductos.Open "SELECT * FROM Rubros_Productos_SF", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstProvincia. Open "SELECT * FROM Provincia", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstLocalidad. Open "SELECT * FROM Localidad", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstRespIva. Open "SELECT * FROM Responsable_Iva", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstDatosEmpresa. Open "SELECT * FROM DatosEmpresa", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstDetalleFactura. Open "SELECT * FROM Detalle_Factura", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstFVentaPago. Open "SELECT * FROM F_VP", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstTipoOperac.Open "SELECT * FROM Tipos_Operaciones_Audit", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstUsuarios. Open "SELECT * FROM Usuarios ORDER BY Usuarios.Nombre_Usuario", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstCompras.Open "SELECT * FROM Compras_A_Proveed", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstProveedores. Open "SELECT * FROM Proveedores", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstEstadoFactura. Open "SELECT * FROM Estado_Factura", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstDetalleCompra. Open "SELECT * FROM Detalle_Compra", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstGraficoCompra. Open "SELECT Mes, Año, MontoTotal FROM GraficoCompra WHERE Año Between #1-1-2002# and #12-31-2002# ", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstTipoFactura. Open "SELECT * FROM TipoFactura", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
rstTipodeUsuario.Open "SELECT * FROM Tipos_Usuarios", cnSistemaFlowers, adOpenDynamic, adLockOptimistic
'Ruta de acceso
ChDir App.Path
On Error GoTo 0 'detiene el control de errores
Falla: 'instruccion del mensaje de error
If Err.Number = Falla Then Exit Sub
MsgBox "Problemas con la Base de Datos, por favor verifique!!!", vbCritical, "ERROR"
Set cnSistemaFlowers = Nothing
Err.Clear
End Sub
No se en que lugar poner ese mensaje,
1 Respuesta
Respuesta de denciso
1