lo = NEWOBJECT("caCustumers","myClass") BROWSEit keeps on asking me for a table
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