Hi all,
this is driving me bonkers.
I have a constructor for a custom class Protease which takes a folderItem (a REALSQLite database) to fill an array of rules.
To this end I query the database with “SELECT * FROM tbl_Proteases ORDER BY ExecutionOrder ASC”
However all the rules are the same rule - it seems to add the same r over and over again.
[code]Sub Constructor(f as FolderItem)
// creating a new protease from a protease database file on disk
//
// Note that the recordset is ordered by ExecutionOrder
db = new REALSQLDatabase
db.DatabaseFile = f
Name = f.NameWithoutExtension
if db.Connect then
Dim rs as RecordSet
// SELECT * FROM tbl_Proteases ORDER BY ExecutionOrder ASC
rs = db.SQLSelect( SQL_to_Populate_Rules )
if db.Error then
MsgBox("Database Error in " + CurrentMethodName + ":" + EndOfLine + EndOfLine + db.ErrorMessage )
else // populate rules from RecordSet
for i as integer = 0 to rs.RecordCount - 1 // RecordCount is 1-based ???
dim r as new Rule
r.ID = rs.Field( "ID" ).IntegerValue
r.Order = rs.Field( "ExecutionOrder" ).IntegerValue
r.TargetSequence = rs.Field( "TargetSequence" ).StringValue
r.ReplacementSequence = rs.Field( "ReplacementSequence" ).StringValue
r.Iterate = rs.Field( "Iterate" ).BooleanValue
r.Info = rs.Field( "Info" ).StringValue
Rules.Append( r )
next
end if
rs.Close
end if
End Sub
[/code]
Where am I going wrong, and how do I fix it?
TIA
Markus
P.S. Using REAL.studio 2012 R1.2 on MacOS X 10.9.3