[Tutor] Dates

John CORRY john.corry at ntlworld.com
Sun Sep 10 23:08:07 CEST 2006


Bob and Alan,

Thanks for the help.  I have gone with the following code and it works!

a = "date(%i,%i,%i)" % (2006,01,31)
b = "date(%i,%i,%i)" % (2006,12,31)
sql = 'SELECT * FROM times where rt_weekst >= %s and rt_weekst <= %s and
rt_type = "%s" ' % (a,b,"R",)
db = mx.ODBC.Windows.DriverConnect('DSN=tnt')
c = db.cursor() 
c.execute(sql)

As you rightly pointed out, I needed to get my sql string formatted and
working before putting it anywhere near the c.execute command.

Many thanks,

John.




More information about the Tutor mailing list