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:
01427215
Vues:
62
Thnks Naomi. The problem was i was following the example here

http://www.code-magazine.com/article.aspx?quickid=0301062&page=4

and they didn't say anything about DataSourceType :-P


>Here is what I have in my CA class to tell the exact source of error:
>
>
>LOCAL llRetVal
>llRetVal = dodefault(luseCursorSchema, lNoData, nOptions, Source)
>
>NODEFAULT
>
>if not m.llRetVal && There was an error trying to execute CursorFill
>	local laError[1]
>	aerror(laError)
>	if laError[1,1] <> 1839
>		=Messagebox("Error trying to execute CursorFill method: " + laError[1,2] + ;
>			chr(13) + chr(10) + "SelectCMD is " + this.selectcmd)	
>	endif
>endif
>
>return m.llRetVal
>
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform