SQLDisconnect(0) clear all clear deform1 = CREATEOBJECT('deform') =deform1.xcODBCde.oXC1.cursorfill() =deform1.xcODBCde.oXC2.cursorfill() =deform1.xcODBCde.oXC3.cursorfill() =deform1.xcODBCde.oXC4.cursorfill() =deform1.xcODBCde.oXC5.cursorfill() DEFINE CLASS deform as Form declasslibrary = Sys(16) declass="xcODBCde" ENDDEFINE DEFINE CLASS xcODBCde as DataEnvironment AutoCloseTables = .F. AutoOpenTables = .f. datasourcetype="ODBC" datasource=SQLSTRINGCONNECT(; "Driver=SQL Server;Server=(local);" + ; "DATABASE=Northwind",.T.) PROCEDURE Init ?SQLGetProp(this.DataSource,"Shared"), SQLSetProp(this.DataSource,"Asynchronous",.F.) this.AddObject("oXC1","xCursorAdapter") this.oXC1.Alias = "Cust1" this.oXC1.SelectCmd = ; "select * from customers" this.AddObject("oXC2","xCursorAdapter") this.oXC2.Alias = "Ord1" this.oXC2.SelectCmd = ; "select * from Orders" this.AddObject("oXC3","xCursorAdapter") this.oXC3.Alias = "prod1" this.oXC3.SelectCmd = ; "select * from products" this.AddObject("oXC4","xCursorAdapter") this.oXC4.Alias = "orddet1" this.oXC4.SelectCmd = ; "select * from [order details]" this.AddObject("oXC5","xCursorAdapter") this.oXC5.Alias = "Ship1" this.oXC5.SelectCmd = ; "select * from shippers" ENDPROC ENDDEFINE DEFINE CLASS xcursoradapter as CursorAdapter breakonerror = .t. DataSourceType = 'odbc' usededatasource = .T. * FetchSize=-1 allowsimultaneousfetch = .T. procedure init this.DataSource = SQLConnect(this.Parent.datasource) * Using next line instead also shares statement handle * this.DataSource = this.Parent.datasource endproc PROCEDURE beforecursorfill(lUseCursorSchema, lNoDataOnLoad, cSelectCmd) ? do while SQLGETPROP(this.parent.datasource, "ConnectBusy")=.t. ??'.' doevents force enddo return .t. endproc PROCEDURE aftercursorfill(lUseCursorSchema, lnoDataOnLoad, cSelectCmd, lResult) ?lUseCursorSchema, lnoDataOnLoad, cSelectCmd, lResult IF !lresult =AError(atest) ?atest[2] endif * Get connection info ?SQLGetProp(this.DataSource,"ODBChdbc") ??SQLGetProp(this.DataSource,"ODBChStmt") endproc enddefine>>>Should each cursoradapter object have its private connection handle ?