You were absolutely correct! Sorry for the slow reply, but I was off for a couple of days and had shelved the problem. Saw your reply today and tried it. I then re-read the mxODBC docs and saw the section that I should have read a little better.
Thanks again.
Bill.
On 1/12/06, Steve Holden <[EMAIL PROTECTED]> wrote:
Bill Witherspoon wrote:
> Hi all,
>
> Am trying to teach myself a bit of Python by creating a small app to
> track tasks, and docs associated with the task. I'm using Python 2.4 on
> Win32 with an Access 2003 db which I'm attempting to talk to using
> mxODBC. I can do Selects without difficulty but a simple Insert has me
> stumped for days. I suspect that I am doing something silly, but I can't
> see it. Searching the list has shown others with similar problems but
> trying them did not yield anything. As an aside, why does [Date] have to
> have [] around it? I get a syntax error from the driver if I don't put
> them in?
>
> My code exits without an error, but doesn't insert anything:
>
> def AddFiles(self, path, files):
> atime = now()
> thedate = str(atime.month) + "/" + str(atime.day) + "/" + str(
> atime.year)
>
> for thefile in files:
> query_string = "Insert into file (ProjectID, [Date],
> Filename, Path) Values (?,?,?,?)"
> values = (self.projectid,thedate,thefile,path)
> ExecuteQuery(query_string, values)
>
> def ExecuteQuery (qrystring, values):
> myconn = connect_db()
> mycursor = myconn.cursor()
> mycursor.execute(qrystring, values)
myconn.commit()
> myconn.close()
> return
>
> def connect_db ():
> myconn = mx.ODBC.Windows.Connect('trackingdb') #using mx.ODBC
> return myconn
>
> Any help/pointers would be appreciated!
>
> Thanks,
> Bill
>
Let me know if this fixes it.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/
--
http://mail.python.org/mailman/listinfo/python-list
-- http://mail.python.org/mailman/listinfo/python-list