cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with using multiple indexes in a SELECT .. order by command on VFP tables

0 Kudos

I have a situation where I am using an adsdataadapter to select data from a VFP table, using two indexes

SELECT * from myTable order by [col1], [col2]

If I only use one or the other of the indexes, the adapter.fill command concludes successfully, however when I try to use both indexes at once, I get the following error:

Error 7039: File attempted to be opened for exclusive use, but it was already open by another user.

The connection string specifies shared access, the table is not open elsewhere, it is just the inclusion of two or more indexes in the select statement that triggers the error.

0 Kudos

I think I have found a workaround for this problem (I think this is a pretty severe problem - not to be able to use multiple indexes on a select - it should be rectified). Anyways, I found that if I do a select without an index, I can successfully use a DataView to simulate the order as such:

(this is in vb.net)

Create myTable using a SQL SELECT statement without an order by clause

dim myView as new DataView(myTable)
myView.Sort = "col1, col2, col3..."
dim myFinalResults as DataTable = dView.ToTable

Now I have a table sorted correctly that I can use

If there is some problem using this technique that I am unaware of, I would appreciate a heads up!

p.s. What's up with that hokey error message about exclusive use? It took me quite a while to finally figure out what was happening - time lost from program development.

Accepted Solutions (0)

Answers (0)