I have a database program which I created some time back to track access
to a secure area. The program (last compiled in April) has developed a
problem in that it will not add new records. All other operations work
fine. When I trie to run the program in the IDE so that I can look at
the problem, it will load the database.
The problem occurs in the following code:
RS = DB.SQLSelect("select fname, lname, empno from people where active
= 'true' order by lname, fname")
If DB.Error Then
ReportError "Error while getting names: " + DB.ErrorMessage, Error
Else
While Not RS.EOF
Names.Append RS.Field("fname").StringValue + " " +
RS.Field("lname").StringValue
EmpNos.Append RS.Field("empno").IntegerValue
RS.MoveNext
Wend
End If
I always get the "Error while getting names" message.
I found the following in the release notes for RB2006 R2:
BooleanColumn (in RecordSets and DatabaseRecords) now write
a '1' for true and a '0' for false into table fields.
Before they wrote the strings 'true' and 'false
And the following in the release notes for R3:
REAL SQL Database: Boolean fields are now more pedantic about what they
expect when using DatabaseField. BooleanValue. Previously, '0' and
'false' were treated as False and anything else was treated as True.
Now, '0' and 'false' are treated as False and '1' and 'true' are treated
as True. The behavior of any other values is undefined if retrieved
using DatabaseField.BooleanValue. DatabaseField.StringValue, on the
other hand, should be able to retrieve the original data if it can't be
identified as a boolean. If the REAL SQL Database can identify the value
as a boolean, however, then False will always return 'false' and True
will always return 'true', regardless of how those values are stored in
the database. This is a side effect of the way in which database engines
interact with the database API in the REALbasic framework. Note that the
change to DatabaseField.BooleanValue should only be an issue if you are
trying to store non-boolean data in a boolean column.
Neither seems to tell me just how to fix my problem. I have tried "where
active = 1", "where active = '1'" and "where active" and all give the
same results as "where active = 'true'". How can I fix this problem so
that I can go looking for the original problem?
Paul Dobbs
Software Engineer, Staff
Lockheed Martin Missiles and Fire Control
Phone (972) 603-1244
Fax (972) 603-2017
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>