Clear Local ; oCA as CursorAdapter, ; oCon as ADODB.Connection, ; oRS as ADODB.RecordSet, ; oXA as XmlAdapter, ; lcReturn as String, ; oError as Exception * ADO Connection to SQL's Northwind (change the server to test) oCon = CreateObject("ADODB.Connection") oCon.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;" ; + "User ID=sa;Initial Catalog=Northwind;Data Source=saliasmovil" oCon.Open() * New recordset oRS = CreateObject("ADODB.RecordSet") oRS.ActiveConnection = oCon * New CA pointing to the Recordset - populate from Orders oCA = CreateObject("CursorAdapter") oCA.DataSourceType="ADO" oCA.DataSource = oRS oCA.SelectCmd = "select * from Orders" oCA.CursorFill() * I detach the cursor and everything is OK ? oCA.CursorDetach() * I kill the RS and CA (assuming the cursor stands now on its own) oRS = null oCA = null * If I close the connection here, I can't do the ##ToXml## bellow * (Comment out the next line and it WORKS) oCon.Close() oCon = null lcReturn = "" oXA = CreateObject( "XmlAdapter") oXA.AddTableSchema( Alias() ) Try * Here ##ToXml## blows oXA.ToXML( "lcReturn" ) Catch to oError ? oError.ErrorNo ? oError.Message ? oError.Details EndTry MessageBox( lcReturn )What I see is that I assumed that once dettached, the cursor was in fact indepent from the underlying recordset. I can workaround this as I can close everything AFTER generating the XML... in this situation.