Visual Basic - CONSULTA

Life is soft - evento anual de software empresarial
 
Vista:

CONSULTA

Publicado por JULIO ESCOBAR (98 intervenciones) el 13/10/2002 20:25:01
AMIGOS: QUIEN PODRA AYUDARME CON ESTA COSA TAN SENCILLA (PARA LOS QUE SABEN) DE UNA BASE DE DATOS QUIERO CONSULTAR (DBGRID) CIERTOS DATOS, EJEMPLO:
DE UNA BASE DE DATOS CON CAMPOS, NOMBRE Y FECHA ENTRADA QUIERO CONSULTAR DE UN RANGO DE LAS FECHAS (DEL 01/09/2002 AL 30/09/2002), SI PUEDEN Y QUIEREN PUEDEN ELABORAR UN "PROGRAMITA SENCILLO" DE EJEMPLO, SE LOS AGRADECERE MUCHO (SOY PRINCIPIANTE), SALUDOS Y 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:CONSULTA

Publicado por David Medina (24 intervenciones) el 20/10/2002 16:24:33
Ejemplo:
1. Pones el formulario
2. Creas el DBGrid
3: Código de seleccion de la BD
4. Llevas los campos y lo muestras al Click en un boton

NOTA: Text1.Text es el parámetro de consulta y ponlo en VB para ver el efecto.
Tu formulario deberá tener un DBGrid, un Command1 y un Adodc1 como mínimo

así:
MySql = "SELECT AXNUMERO, AXPOLIZA, AX_INICIO, AX_FIN FROM ANEXO "
MySql = MySql + "WHERE AXPOLIZA='" & Text1.Text & "'"
Me.Adodc1.RecordSource = MySql
Me.Adodc1.Refresh

If Me.Adodc1.Recordset.EOF = True Then
MsgBox "No existe ningún registro con ese número de póliza", vbInformation + vbOKOnly
Exit Sub
End If

Set Me.DataGrid1.DataSource = Me.Adodc1.Recordset
Me.DataGrid1.Columns(0).Caption = "Anexo No."
Me.DataGrid1.Columns(1).Caption = "Póliza No."
Me.DataGrid1.Columns(2).Caption = "Inicio"
Me.DataGrid1.Columns(3).Caption = "Fin"
Me.DataGrid1.Visible = True
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