I am working with ArcObjects, in particular the ICursor Interface. I am creating a cursor and looping through a query's result set. My problem/concern is how to close or delete or release the cursor once I'm done looping through the query's result set. The query is being passed into a Sql workspace (via ISqlWorkspace interface). Code is as follows
ISqlWorkspace pSQL_WS = myWorkspace as ISqlWorkspace;ICursor pCursor = pSQL_WS.OpenQueryCursor(strQuery);string cursorResults = "";IRow pRow;while ((pRow = pCursor.NextRow()) != null){ int fc = pRow.Fields.FieldCount; for (int x = 0; x < fc; x++) { cursorResults += pRow.get_Value(x).ToString() + " "; } cursorResults += Environment.NewLine;}_textElement.Text = Convert.ToString(cursorResults); I'm actually taking the results of the query and placing them in a text element. I'm thinking after the last line is where I'd want to close/delete/release my cursor, but I'm just not sure how to go about doing this. Any help on the topic would be greatly appreciated. Thanks in advance.
أكثر...
ISqlWorkspace pSQL_WS = myWorkspace as ISqlWorkspace;ICursor pCursor = pSQL_WS.OpenQueryCursor(strQuery);string cursorResults = "";IRow pRow;while ((pRow = pCursor.NextRow()) != null){ int fc = pRow.Fields.FieldCount; for (int x = 0; x < fc; x++) { cursorResults += pRow.get_Value(x).ToString() + " "; } cursorResults += Environment.NewLine;}_textElement.Text = Convert.ToString(cursorResults); I'm actually taking the results of the query and placing them in a text element. I'm thinking after the last line is where I'd want to close/delete/release my cursor, but I'm just not sure how to go about doing this. Any help on the topic would be greatly appreciated. Thanks in advance.
أكثر...