VTable.Sort gives vexception error -39?

Andrew Dempsey andrew at andrewdempsey.com
Wed Jan 27 03:50:46 CST 2010


Hi all,

I am having trouble using VSort on a table in RealBasic.  Would anyone  
have an example I could look at, or be able to look over my code and  
tell me what I am doing wrong?  When I run  
table.sort(allRecs,fldName), I get  VException with an errorcode of  
-39, and no description.

I am trying to sort all of the records in a table by one of its fields  
which is called "itemCategoryName".

   dim f As FolderItem = GetFolderItem("myDB.vdb")

   dim currDB As VDatabase = New VDatabase
   currDB.Open(f)

   dim table As VTable = currDB.Table("itemCategories")
   dim bs_allRecs As VBitSet = table.SelectAllRecords
   dim allRecs As Vset =  
bs_allRecs.Clone                                      // is this the  
best way?  Seems awkward.
   dim fldName As VField = table.Field("itemCategoryName")
//everything so far works in the debugger, and returns correct values  
with the correct number of records, etc.

//the following line gives me a VException, with error shown as -39,  
and no description.
   dim sortedSet As VArraySet = table.Sort( allRecs, fldName )


Here's the sql dump of the table from the DB:

CREATE TABLE "ItemCategories" (
	"itemCategoryName" STRING (256)  NOT NULL,
	"isCustomCategory" BOOLEAN  NOT NULL INDEXED DEFAULT '1');

Thanks in advance for any help!

------------------------------------------------
Andrew Dempsey
andrew at andrewdempsey.com





More information about the Valentina mailing list