Hi all,

I am trying to use the index and seek instructions to find a record by a
index. at the moment I am not able to get this working. I am using eMbedded
Visual Basic 3.0 and the code I am trying is this:

Dim rs As ADOCE.Recordset
Dim rsArt As ADOCE.Recordset
Dim objConn As ADOCE.Connection
Dim cCon As String
Dim cConN As String
Dim nReg As Long
'Dim Id(1) As String

Set rs = CreateObject("ADOCE.Recordset.3.0")

Me.Buscar.Caption = "Busca.."

'Abre la conexion
Set objConn = CreateObject("ADOCE.Connection.3.0")
objConn.Open "Provider=CEDB;" & _
"data source = \My Documents\Articulos.cdb"

cCon = "ARTICULOS"
rs.Open cCon, objConn, adOpenDynamic, adLockOptimistic, adCmdTableDirect
rs.Index = "PrimaryKey"
Id(0) = Trim(refart.Text)
rs.Seek Id(0), adSeekFirstEQ

If Not rs.EOF Then 'si encuentra el articulo
'MsgBox ("entra")
If IsNull(rs.fields(1).Value) Then
codbar.Text = ""
Else
codbar.Text = rs.fields(1).Value
End If

If IsNull(rs.fields(2).Value) Then
descrip.Text = ""
Else
descrip.Text = rs.fields(2).Value
End If

rs.close
Set rs = Nothing

Please help me, Thanks in advance.

Javier Martinez

Re: seek and index with ADOCE and .cdb files by Peter

Peter
Tue Dec 30 09:00:26 CST 2003

ADOCE does not support the Find and Seek methods with Pocket Access (.cdb)
databases.

Peter

--
Peter Foot
www.inthehand.com
Windows Embedded MVP

"news.microsoft.com" <javier_martinez1@hotmail.com> wrote in message
news:uARmU1qzDHA.1660@TK2MSFTNGP09.phx.gbl...
> Hi all,
>
> I am trying to use the index and seek instructions to find a record by a
> index. at the moment I am not able to get this working. I am using
eMbedded
> Visual Basic 3.0 and the code I am trying is this:
>
> Dim rs As ADOCE.Recordset
> Dim rsArt As ADOCE.Recordset
> Dim objConn As ADOCE.Connection
> Dim cCon As String
> Dim cConN As String
> Dim nReg As Long
> 'Dim Id(1) As String
>
> Set rs = CreateObject("ADOCE.Recordset.3.0")
>
> Me.Buscar.Caption = "Busca.."
>
> 'Abre la conexion
> Set objConn = CreateObject("ADOCE.Connection.3.0")
> objConn.Open "Provider=CEDB;" & _
> "data source = \My Documents\Articulos.cdb"
>
> cCon = "ARTICULOS"
> rs.Open cCon, objConn, adOpenDynamic, adLockOptimistic,
adCmdTableDirect
> rs.Index = "PrimaryKey"
> Id(0) = Trim(refart.Text)
> rs.Seek Id(0), adSeekFirstEQ
>
> If Not rs.EOF Then 'si encuentra el articulo
> 'MsgBox ("entra")
> If IsNull(rs.fields(1).Value) Then
> codbar.Text = ""
> Else
> codbar.Text = rs.fields(1).Value
> End If
>
> If IsNull(rs.fields(2).Value) Then
> descrip.Text = ""
> Else
> descrip.Text = rs.fields(2).Value
> End If
>
> rs.close
> Set rs = Nothing
>
> Please help me, Thanks in advance.
>
> Javier Martinez
>
>