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
Titre:
I can't browse my cursor adapter class
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01427201
Message ID:
01427201
Vues:
299
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
.......
DO WHILE .T.
      ME.Work()
ENDDO
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform