Visual Basic - Busqueda al escribir

Life is soft - evento anual de software empresarial
 
Vista:

Busqueda al escribir

Publicado por Walter (49 intervenciones) el 27/07/2007 15:27:35
Necesito hacer una buscqueda en una base de datos comoel autocompletar de excel la informacion sera mostrada en un grid y sera la busqueda a traves de un textbox gracias de antemano.
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:Busqueda al escribir

Publicado por Yendri (14 intervenciones) el 27/07/2007 18:42:54
'declaracion general de variables
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Const strConexion = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=C:\Archivos de programa\Microsoft Visual Studio\VB98\NWIND.MDB"
Dim strQuery As String

Private Sub Text1_Change()
Screen.MousePointer = 11
Set cnn = Nothing
Set rst = Nothing
MSHFlexGrid1.Redraw = False
Set MSHFlexGrid1.DataSource = Nothing
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
strQuery = "SELECT IdCliente, NombreCompañía FROM Clientes WHERE " & _
"NombreCompañía LIKE'" & Trim(Text1.Text) & "%' ORDER BY NombreCompañía"
cnn.Open strConexion
rst.Open strQuery, cnn, adOpenStatic, adLockOptimistic, adCmdText
Set MSHFlexGrid1.DataSource = Nothing
If rst.RecordCount <> 0 Then
Set MSHFlexGrid1.DataSource = rst
Else
MSHFlexGrid1.Clear
MSHFlexGrid1.Rows = 2
End If
rst.Close: cnn.Close
Set cnn = Nothing
Set rst = Nothing
MSHFlexGrid1.Redraw = True
Screen.MousePointer = 1
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

RE:Busqueda al escribir

Publicado por Walter (49 intervenciones) el 27/07/2007 21:40:01
Mil Gracias funciona a la perfeccion muy agradecido, Salu2
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