Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I can't browse my cursor adapter class
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01427201
Message ID:
01427202
Views:
152
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform