Visual Basic - DATALIST Y SELECTEDITEM

Life is soft - evento anual de software empresarial
 
Vista:

DATALIST Y SELECTEDITEM

Publicado por VICTOR (31 intervenciones) el 07/04/2009 23:09:14
HOLA PROGRAMADORES, no he podido salir de este problemilla resulta que tengo al fin logre enlazar un datalist a una base de datos de mysql el codigo es le sgte:

SQLVM = "SELECT * FROM ITEM WHERE linea=1 ORDER BY nombre"
Set RS1 = New ADODB.Recordset
Set RS1.ActiveConnection = CN
With RS1
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Open SQLVM, CN
.CacheSize = 100

End With

With DataList1

.ListField = "nombre"
'.DataField = "nombre"
'.BoundColumn = "nombre"
Set .DataSource = RS1
Set .RowSource = RS1
End With

esto funciona y el datalist funciona bien, pero que necesito que cuando seleccione un campo del datalist me muestre los datos en unas cajas de texto es decir algo mas o meno asi:

CN.RS1.Bookmark = DataList1.SelectedItem
Text1.Text = RS1.Fields("id")
Text7.Text = RS1.Fields("nombre")
aqui ya no funciona, alguien podria ayudarme gracias
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:DATALIST Y SELECTEDITEM

Publicado por P3L30N2009 (699 intervenciones) el 08/04/2009 10:51:35
Con el método Find de ADO y la propiedad BoundText del DataList:

Private Sub DataList1_Click()
RS1.MoveFirst
RS1.Find "Nombre='" & DataList1.BoundText & "'"
Text1.Text = RS1!id
Text7.Text = RS1!Nombre
End Sub
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