Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I can't browse my cursor adapter class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01427201
Message ID:
01427202
Vues:
153
This message has been marked as the solution to the initial question of the thread.
Usually you don't call CursorFill from the Init.

You may find out the exact error from CursorFill method if you override it. Also, what alias did you give to your CA?

Did you specify DataSourceType?


>can some body help me out with this. i have create a cursor adapter class, and i am trying to fill it and browse the results
>
>but it seems not to be working. when i go
>
>
>
>lo = NEWOBJECT("caCustumers","myClass")
>BROWSE
>
>
>
>it keeps on asking me for a table
>
>here is the class code
>
>
>
>DEFINE CLASS cacustomers AS cursoradapter
>
>
>	Height = 22
>	Width = 23
>	Name = "cacustomers"
>
>
>	PROCEDURE Init
>		LOCAL lcConnStr, lnConn, llRetVal 
>		** string assumes trusted connection (integrated security)
>		lcConnStr = "Driver=SQL Server;Server=(local);DATABASE=Northwind;uid=sa;pwd=12345"
>		lnConn = SQLSTRINGCONNECT(lcConnStr)
>		 
>
>		WITH This
>		  llRetVal = .T. 
>
>		  IF lnConn > 0 THEN 
>		    .DataSource = lnConn
>		    .SelectCmd = "SELECT CustomerID, CompanyName, ContactName, "+ ;
>		      "Address, City, Region, Country "+ ;
>		      "FROM Customers WHERE CompanyName LIKE 'C%'"
>		    
>		    IF NOT .CursorFill() THEN 
>		      ** unable to fill. 
>		      llRetVal = .F. 
>		    ELSE 
>		      .Tables = "customers"
>		      .KeyFieldList = "CustomerID"
>		      .UpdatableFieldList ="CompanyName, ContactName, Address, "+ ;  
>		        "City, Region, Country"
>		      .UpdateNameList= "CustomerID Customers.CustomerID, " + ;
>		        "CompanyName Customers.CompanyName, ContactName " + ;
>		        "Customers.ContactName, Address Customers.Address, " + ;
>		        "City Customers.City, Region Customers.Region, " + ;
>		        "Country Customers.Country"
>		      
>		      STORE .T. to .AllowDelete, .AllowInsert, .AllowUpdate 
>		    ENDIF 
>		  ELSE 
>		    ** unable to connect
>		    llRetVal = .F. 
>		  ENDIF 
>		ENDWITH 
>
>		RETURN llRetVal
>	ENDPROC
>
>
>	PROCEDURE Destroy
>		IF this.DataSource > 0 THEN 
>		  SQLDISCONNECT(this.DataSource)
>		ENDIF
>	ENDPROC
>
>
>ENDDEFINE
>*
>*-- EndDefine: cacustomers
>**************************************************
>
>
>
>Karben Selim Mejia
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