Platform: Win
Python Version: 2.4.4 on win32
Dabo Version: Version 0.8a; Revision
UI Version: 2.6.3.3 on wxMSW
Form has a dTextBox, regID = "keyBox", a dButton, and another dTextBox,
regID = "thisBand".
(Note in passing: some VERY funky stuff is going on in the Class Designer.
This form was completely set up yesterday, saved, and brought up again
today. As I double-checked while writing this, I noted the following things:
1. In the Object Info treeview, the node for the first textbox has "keyBox
(dTextBox).
2. In the Object Info properties list for the first textbox, RegID is
blank, empty, a string of len() = 0.
3. In the Object Info treeview, the node for the second textbox has
"dTextBox (dTextBox)".
4. In the Object Info properties list for the second textbox, RegID has
"thisBand".
Also, I still can't remove a control from the form, then right-click and
get a context menu to let me replace it with something else. I have to
remove EVERYTHING before I can get that context menu back.)
Anyway, I'm still trying to put a PK value in keyBox, run a query when I
press the button, and get the contents of what I think should be the one
returned field in the one returned row to show up in thisBand. I've tried
two different ways of setting up the biz object, both of which are taken
directly from suggested code. For the code from the wiki How-to, I keep
getting a KeyField Error 'pkid' when I call the biz object's requery()
method. Using the code that John suggested for customizing a biz object
query, I get a "no attribute 'setWhereClause'" error.
Here's the traceback without "John's suggested" code:
Traceback (most recent call last):
File "C:\Program Files\Dabo Runtime\dabo\lib\eventMixin.py", line 97, in
raiseEvent
File "c:\docume~1\kend\locals~1\temp\tmpx5s8o5.py", line 114, in onHit
File "C:\Program Files\Dabo Runtime\dabo\biz\dBizobj.py", line 707, in
requery
File "C:\Program Files\Dabo Runtime\dabo\biz\dBizobj.py", line 852, in
_moveToPK
File "C:\Program Files\Dabo Runtime\dabo\db\dCursorMixin.py", line 1379,
in moveToPK
File "C:\Program Files\Dabo Runtime\dabo\db\dCursorMixin.py", line 1362,
in _getRecordByPk
KeyError: 'pkid'
This is the traceback with "John's suggested" code:
Traceback (most recent call last):
File "C:\Program Files\Dabo Runtime\dabo\lib\eventMixin.py", line 97, in
raiseEvent
File "c:\docume~1\kend\locals~1\temp\tmpbdornb.py", line 116, in onHit
AttributeError: 'NoneType' object has no attribute 'setWhereClause'
Form code follows:
## *!* ## Dabo Code ID: dButton-dForm
def onHit(self, evt):
# I assume this gets me a reference to the biz object I set up
# in Form.afterInit(). I shouldn't have to re-do that here, right?
biz = self.Form.getBizobj("musBands")
# This, I presume, gets me a string value, which should be okay
# even though the pkid field is type int, because the SQL query has
# to be a string, right?
myPK = self.Form.keyBox.Value
# I tested with 3; this prints "myPK = 3"
print "myPK = " + myPK
# If I use the commented-out afterInit() lines labeled "John's
# suggestion", this throws an error: no attribute 'setWhereClause'.
biz.setWhereClause("musBands.pkid = " + myPK)
# "musBands.pkid = 3"
print biz._CurrentCursor.sqlManager._whereClause
# If we don't use the "John's suggestion" code, we get this far,
# then get KeyError: 'pkid'
biz.requery()
# Nothing happens, I think, after the above error. thisBand
remains blank.
# There's definitely data in there; the MySQL command line client
returns
# "Animals, The" for the query: SELECT bandname FROM musBands
WHERE pkid = 3
self.Form.thisBand.DataSource = "musBands"
self.Form.refresh()
## *!* ## Dabo Code ID: dForm-top
def afterInit(self):
self.Application.addConnectFile("C:\DaboProjects\MyMusic\mymusic.cnxml")
conn = self.Application.getConnectionByName("main")
biz = dabo.biz.dBizobj(conn)
# Following John's suggestion.
#biz.DataSource = "mymusic3.musBands"
biz.DataSource = "musBands"
# Following John's suggestion.
#biz.addFrom("mymusic3.musBands")
biz.KeyField = "pkid"
biz.addField("bandname")
self.addBizobj(biz)
Thanks for any help.
Ken Dibble
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.3/700 - Release Date: 2/24/2007 8:14
PM
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users