ODBC / DBI help (via Win32 Extensions)

Richard Chamberlain richard_chamberlain at ntlworld.com
Sat Apr 29 04:20:32 EDT 2000


Benjamin,

I've set up a simple table with one field a date field and inserted into it
okay.

On your INSERT statement you had speech marks around the date so:
'#12/15/00#'

mycursor.execute('INSERT INTO Table1 (myDate) VALUES (#12/15/2000#)')

I know that doesn't answer your question about dbiDates but you may not
require that depending on where you're getting your date from.

Richard

You don't actually need those so it should be just #12/15/00#.

My statement was
Benjamin Schollnick <junkster at nospam.rochester.rr.com> wrote in message
news:rNHvjEdhm5Pp-pn2-dzBINcOCBoWi at d185d18f2.rochester.rr.com...
> On Sun, 29 Apr 3900 04:49:53, "S. Hoon Yoon" <cpu at bigfoot.com> wrote:
>
> > I think that's because you should use format #date# on update. Unless, I
did
> > not understand your problems.
> > That's really more of SQL and access convention rather than Python.
> > Pls look at the docs for Access and SQL.
> >
> > UPDATE [BT Dates] SET [BT Dates].[date] = #12/12/2000#;
> >
> > This is what I get if I use Query wizard and you should follow it.
> > Hope it helps,
>
> The real problem is that I can't find any documentation on the DBI
> module...
>
> The pound convention I found out about...
> Unfornately, I don't have my code with me... But...(From memory)
>
> sql_cmd = """
> INSERT INTO logfile (datetime, loglevel,, logdata)
> VALUES ('#12/15/2000#', 1, 'test')
> """
> # I've tried 12/15/00, 09/09/99, 09/09/1999, and a few other
> # date variants....
>
> # And as far as I can tell the ODBC execute command
> # appends a semicolon?  Or at least everything works
> # without having me add one...
>
> If I attempt to execute that command, I get a SQL error from the ODBC
> driver.
>
> If I remove the datetime field and just submit using the loglevel,
> logdata
> it works fine... (But that sort of defeats the purpose of a log
> file....)
>
> The datetime field is setup in Access as a standard "Date/Time"
> field, so I figure I might need to convert the datetime field into a
> dbiDate
> record, but as I mentioned I can't find any instructions on the fields
> &
> methods for the dbiDate field(s).... (I checked the Win 32
> documentation
> without any luck).
>
> - Benjamin





More information about the Python-list mailing list