Visual Basic - Cambiar recordsource según acceso

Life is soft - evento anual de software empresarial
 
Vista:

Cambiar recordsource según acceso

Publicado por Ana (5 intervenciones) el 19/05/2004 22:38:50
Hola, estoy trabajando con un datagrid y un adodc. Estoy intentando que al acceder al datagrid cambie según la persona que ha entrado, pero no me hace caso.
el código es:
if user=client
Adodc1.CommandType = adCmdText
'Adodc1.RecordSource = "select * from Clients where num <= 2001"
If user = auxiliar Then
Adodc1.RecordSource = "select * from Clients where num <= 2001"
Else
Adodc1.RecordSource = "select * from Pacients_General where llit >= 2001"
End If

No me funciona
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:Cambiar recordsource según acceso

Publicado por El Cala (27 intervenciones) el 19/05/2004 23:09:10
Fijate que para generar la consulta primero tienes que desvincular el datagrid y al final volver a vincularlo al recordset. Aca va un ejemplo:

set datagrid1.datasource=nothing
if user=client
Adodc1.CommandType = adCmdText
'Adodc1.RecordSource = "select * from Clients where num <= 2001"
If user = auxiliar Then
Adodc1.RecordSource = "select * from Clients where num <= 2001"
Else
Adodc1.RecordSource = "select * from Pacients_General where llit >= 2001"
End If
set datagrid1.datasource=Adodc1.RecordSource
datagrid1.rebind
datagrid1.refresh
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