Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor Adapter
Message
 
À
15/04/2006 10:01:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01113690
Message ID:
01113877
Vues:
13
Your variable oCA is public, The last defined CA is the last what oCA contains, all previous are released.
Return CA object from that function. That way you didn't need to PUBILC oCA:
SET PROCEDURE TO ThatPRG.PRG (I forgot thename of PRG :o))))
**In your form Init Event
thisform.AddProperty([MyFirstCA])
thisform.MyFirstCA = FunctionName([malias])
thisform.MyFirstCA.CursorFill(.f.)
thisform.AddProperty([MySecondCA])
thisform.MySecondCA = FunctionName([SecondAlias])
thisform.MySecondCA.CursorFill(.f.)
***etc.
(not tested)




>I am creating cursoradapter objects thru this prg :
>************************************************************************
>nAutoRefreshConn=SQLSTRINGCONNECT('Dsn=Kohconn;uid="xyz";TRUSTEDCONNECTION=YES')
>MSTRIN = SQLGETPROP(nAutoRefreshConn,"ConnectString")
>iF nAutoRefreshconn < 0
> = MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error')
>ELSE
> = MESSAGEBOX('Connection made', 48, 'SQL Connect Message')
> *= SQLDISCONNECT(gnHandle)
>ENDIF
>
>public oCA As CursorAdapter
>
>oCA=CREATEOBJECT("CursorAdapter")
>oCA.Alias = malias
>oCA.BufferModeOverride= 5
>oCA.DataSource= nAutoRefreshConn
>oCA.DataSourceType="ODBC"
>oCA.SelectCmd="select * from " + malias &&mstones
>oCA.UseCursorSchema = .T.
>TEXT TO lcSQL TEXtMERGE NOSHOW PRETEXT 15
> select column_name,data_type,numeric_precision,numeric_scale
> from information_schema.columns
> where table_name = '<>'
>ENDTEXT
>SQLEXEC(nAutoRefreshconn,lcSQL,[mTest])
>SELECT MTest
>cSelectCmd = []
>cUpdateNameList = []
>cUpdatableFieldList = []
>lcAddComma = []
>SCAN
> cSelectCmd = cSelectCmd + lcAddComma + ALLTRIM(column_name)
> cUpdateNameList = cUpdateNameList + lcAddComma + ALLTRIM(column_name) + [ ] + malias+[.] + ALLTRIM(column_name)
> lcAddComma = [,]
>ENDSCAN
>*cSelectCmd = cSelectCmd + [ FROM ] + malias
>oCA.UpdatableFieldList = cSelectCmd
>oCA.UpdateNameList = cUpdateNameList
>oCA.CursorFill( .f.,,,)
>
>***************************************************************
>
>My intension is i want to use this prg to create cursoradapter in the forms instead of creating it at design time
>but through this prg i m able to use only last cursoradapter as there are many cursoradapters i want to use
>
>thanks.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform