Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VB code
Message
De
14/03/2003 11:28:41
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
14/03/2003 11:06:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00765891
Message ID:
00765903
Vues:
20
>I would like to write these codes in VB
>
>1 – open a VFP table (independent table and table in a database)
> if not used(“mytable”)
> use mytable in 0
> endif
> select mytable
>
>2 – search a record in a table
> locate for xfield=xvar
> if found()
> endif
>
>3 – Write in a table
> replace xfield with xvar
>
>4 – name of the computer
> xmac=alltr(sys(0))
> xmac=upper(alltr(substr(xmac,1,at('#',xmac)-1)))
>
>5 – create a table or cursor
> CREATE CURSOR csResult (field1 I)
> CREATE table csResult (field1 I)
>
>6 – scan a table
> select mytable
> scan
> endscan
>
>7 – does a file exist
> if file(“c:\myfile.dbf”)
> endif

Martin,
There are multiple ways to do that from VB. One way is to use ADO and there are many samples here and elsewhere and on MSDN online (ie: ADO jumpstart for VFP developers by JVP)
Another way is to do that in the laguage you know - VFP and create a COM DLL using OLEPUBLIC keyword in class definition. ie :

define class myRoutines as session Olepublic
Datasession=2
procedure SearchARecordInaTable
lparameters tcTableName, tcField, tuValue
use (tcTableName)
locate for eval(tcField)=tuValue
if found()
endif
endproc
enddefine

Assuming you created myVFP project for the above and compiled to DLL :

set oVFP = createobject('myVFP.myRoutines')
oVFP.SearchARecordInaTable(ParamsHere)

Another option is to use ready VFP ole automation object :
set oVFP = createobject('VFP.Application')
oVFP.DoCmd('SomeVFPCommand')

The more natural one for your purpose might be ADO way.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform