On 10/16/2008 5:55 PM, Peter Machell wrote:
...If I hard code the password, the connection works fine:
cnxn = pyodbc.connect("DSN=test;UID=test;PWD=test")
However substituting a variable fails:
passwd='test'
connectstring='pyodbc.connect("DSN=test;UID=test;PWD='+passwd+'")'
cnxn = connectstring
...
Try printing the string to screen first :-)
You have single quotes embedded in the variables based so the variable
is never in place. Use % markers instead and make your life easier :-)
_______________________________________________
DB-SIG maillist - DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig