Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/02/2006, 09:09
antonio2005pe
 
Fecha de Ingreso: agosto-2005
Ubicación: Peru-Lima
Mensajes: 225
Antigüedad: 19 años, 7 meses
Puntos: 0
Exclamación Enlazar DataGrid con RecordSet (AdoCodigo)

hola amigos kisiera saber por k me bota error cuando le digo Set DataGrid1.RecordSource = RS cada vez k hago una consulta, aki esta mi codigo:
Código:
Dim CN As New ADODB.Connection
Dim RS As New ADODB.Recordset

Private Sub Command1_Click()
CN.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BD;Data Source=SERVIDOR"
CN.Open

RS.CursorLocation = adUseClient
RS.LockType = adLockOptimistic
RS.ActiveConnection = CN
RS.Open "SELECT * FROM CLIENTES"
 
Set DataGrid1.DataSource = RS 'Aki Enlaza normalmente
End Sub

Private Sub Command2_Click()
sql = "select * from clientes where doc_id='" & Text1.Text & "'"
Set RS = CN.Execute(sql)
Set DataGrid1.DataSource = RS 'Pero aki me bota error :@ :(
End Sub
Gracias...

Última edición por antonio2005pe; 04/03/2006 a las 04:45