Ver Mensaje Individual
  #8 (permalink)  
Antiguo 08/12/2006, 21:23
Avatar de el mago de oz
el mago de oz
 
Fecha de Ingreso: octubre-2005
Mensajes: 192
Antigüedad: 18 años, 8 meses
Puntos: 0
Re: VB.net 2005 ¿como rescato un campo de una bd?

ok... hace tiempo hice esta pregunta... hoy la volvi a revisar.. y despues de su ayuda he aqui la solucion:

Public oconn As New ADODB.Connection
Public rst_inicio As New ADODB.Recordset
Public path As String
Dim i As Integer


path = Application.StartupPath & "\dbase\usuarios.mdb"

With oconn
.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & path & ";Uid=;Pwd=;"
.Open()
End With

rst_inicio.Open("Select * from opciones", oconn, 1, 2)

i = 0

Do While Not (rst_inicio.BOF Or rst_inicio.EOF)
i = i + 1
With rst_inicio
' Asignar a las variables el contenido del registro
primeravez = .Fields("primeravez").Value & ""
'vcomite = .Fields("comite").Value & ""
End With

' Mostrar el siguiente registro
rst_inicio.MoveNext()
Loop

If i = 0 Then
' No se ha encontrado ningún registro que coincida con la selección
End If
'
rst_inicio.Close()

'si quieres cierras la conexion oconn

en el fondo:

primeravez = .Fields("primeravez").Value & ""

reemplaza a :

primeravez=!primeravez

ciao
__________________
"No a las dictaduras, no a la impunidad, no al comercio injusto que explota al menor de edad. Sí a las autocracias, sí a la libertad, el tercer mundo va a estallar."
Finisterra MAGO DE OZ