Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Two CursorAdapters don't have two cursors opened
Message
 
 
À
13/03/2007 11:26:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01203001
Message ID:
01203020
Vues:
15
Looks like you're creating just one instance of the CA, so I'm not sure of the problem.

The code seems too complex for me, I prefer to have my CA classes defined visually (using Mark McCasland's CA Builder) and then just add an instance of the class to the form.

>I hope this code can be understood. If not please let me know
>Thanks a lot
>Hernan
>
>*!*	LOAD event of the form
>
>WITH this
>     LOCAL cSelectCmd AS String
>
>     cSelectCmd = "SELECT Expr_cli.Expr_cliid, Expr_cli.Expreso, Expr_cli.Clienteid " +;
>                    "FROM Datos!Expr_cli " +;
>                   "WHERE Expr_cli.Clienteid = '0'"
>
>     .Ca("caExpr_cli", "Expr_cli", "curExpr_cli", .T., cSelectCmd, "Expr_cli")
>
>     SELECT curExpr_cli
>ENDWITH
>
>
>*!*	Ca method of the form
>Lparameters toObjeto, tcTabla, tcAlias, tcSelectCmd, tcListaTablas
>
>** genera un cursor adapter de una sola tabla, actualizable o no, vacio o no
>
>Local cSchema as String, cUFL as String, cUNL as String, lOK as Boolean, cSelectCmd as String, cThis as String
>
>lOK = .T.
>
>*******************************************
>*!*	In here it generates the UpdatableFieldList, the UpdateNameList and the CursorSchema using the table for that
>Try
>
>    If Vartype(tcSelectCmd) = "C"
>       cSelectCmd = tcSelectCmd
>	   This.armaschema(tcTabla, cSelectCmd, tcAlias)
>       cSelectCmd = tcSelectCmd + [ into cursor ] + tcAlias
>    else
>	   This.OpenTable(tcTabla, tcAlias)  && abre la tabla
>	   This.armaschema(tcTabla, '', tcAlias)
>    endif
>
>Catch To oException
>
>	lOK = .F.
>	This.mensaje("No se pudo generar el schema en el cursor " + tcAlias + Chr(13) + oException.Message)
>
>Endtry
>
>If lOK = .F.
>	Return
>Endif
>****************************************************
>
>cUFL    = This.cUFL                        && updatable field list
>cUNL    = This.cUNL      				   && update name list	
>cSchema = This.cSch						   && table schema	
>
>This.CloseTable(tcAlias)                   && cierra la tabla antes de armar el CA
>
>lOK = .T.
>
>Try
>	If Vartype( "This." + toObjeto  ) = "O"
>		Removeproperty(This, "toObjeto ")
>	Endif
>
>	This.AddProperty((toObjeto ))
>
>    cCa  = "This." + toObjeto  + " = Createobject('cursoradapter')"
>    &cCa
>
>
>Catch To oErrores
>
>	Messagebox("No se pudo generar el objeto CursorAdapter"+;
>		Chr(13)+oErrores.Message,16,"Atención",2000)
>
>	lOK = .F.
>
>Finally
>Endtry
>
>If lOK = .F.
>	Return
>Endif
>
>
>If lOK = .T.
>	Try
>
>        cSelectCmd = tcSelectCmd
>
>		cThis = 'This.' + toObjeto
>
>		cDataSourceType = cThis + '.DataSourceType = "NATIVE"'
>		cAlias          = cThis + '.Alias = "' + tcAlias + '"'
>
>		If Vartype(tcListaTablas) = "C" and Len(Alltrim(tcListaTablas)) > 0
>		   cTables      = cThis + '.Tables = "' + tcListaTablas + '"'
>		else
>		   cTables      = cThis + '.Tables = "' + tcTabla+ '"'
>		endif
>
>		cDataSourceType     = cThis + '.DataSourceType = "NATIVE"'
>		cAlias              = cThis + '.Alias = "' + tcAlias + '"'
>		cTables             = cThis + '.Tables = "' + tcTabla + '"'
>		cBufferModeOverride = cThis + '.BufferModeOverride = 5'
>		cKeyFieldList       = cThis + '.KeyFieldList = "' + this.cCampoClave + '"'
>		cSendUpdates        = cThis + '.SendUpdates = .T.'
>		cSelectCmd          = cThis	+ '.SelectCmd = "' + cSelectCmd + '"'
>		cUpdatableFieldList = cThis + '.UpdatableFieldList = "' + cUFL + '"'
>		cUpdateNameList 	= cThis + '.UpdateNameList = "' + cUNL + '"'
>		cCursorSchema       = cThis + '.CursorSchema = "' + cSchema + '"'
>		cCursorFill	        = cThis + '.CursorFill()'
>
>		&cDataSourceType
>		&cAlias
>	    &cTables
>		&cBufferModeOverride
>		&cKeyFieldList
>		&cSendUpdates
>		&cSelectCmd
>		&cUpdatableFieldList
>		&cUpdateNameList
>		&cCursorSchema
>		&cCursorFill
>
>        Select ( tcAlias )
>
>	Catch To oErrores
>
>		Messagebox("No se pudo generar el Cursor "+tcAlias+Chr(13)+oErrores.Message;
>			,16,"Atención",3000)
>
>		lOK = .F.
>
>	Endtry
>Endif
>
>Return lOK
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform