Re: Error Binding Parameter 0 -- FIXED
Rich Shepard <[email protected]>
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 20 Dec 2006, Adrian Klaver wrote:
> My next suggestion would to see if the varDlg() functions are really returning
> what you want. Sprinkle some print statements i.e print varDlg().varName to
> see if you are getting the varName. Also in the OnVarAdd function you assign
> varDlg() to newVar,you might want to use the assigned name i.e.
> newVar.varName. I don't know how the rest of the module is set up but the
> newVar assignment may be masking varDlg()
Adrian,
Thank you for forcing my head straight again. Tracing what was happening
-- or not happening when print statements produced nothing -- finally led me
to correct all the mistakes I made last summer when I initially wrote this
module.
Among the errors was calling the varDlg() class rather than the newVar
instance of the dialog box, getting the itemIDs rather than the text, and so
on.
Just for posterity (since this thread will certainly be stuffed somewhere
on the Web for future generations to find), here's the working code for the
same method I posted yesterday:
def OnVarAdd(self, event):
newVar = varDlg()
result = newVar.ShowModal()
if result == wx.ID_OK:
# extract values from dialog box widgets; assign to new variable names
vn = newVar.varName.GetValue()
vd = newVar.varDesc.GetValue()
vp = newVar.polName.GetValue()
vs = newVar.subName.GetValue()
# now insert these strings in the widgets on the notebook page
self.vname.SetValue(vn)
self.vdesc.SetValue(vd)
self.vpol.SetValue(vp)
self.vsub.SetValue(vs)
# also save the values into the project model database table.
if self.appData.dbFileName != ' ':
stmt1 = """insert into variable(var_name, var_desc, policy_name, sub_policy_name)
values (?,?,?,?)"""
self.appData.cur.execute(stmt1,(vn, vd, vp, vs))
self.appData.con.commit()
newVar.Destroy()
Many thanks, and the best of the holidays to you.
Rich
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863