我正在尝试使用string format()方法创建连接字符串。
以下是我的代码:
connStr = 'DRIVER={ODBC Driver 13 for SQL Server};SERVER={s};PORT=1443;DATABASE={d};UID={u};PWD={p}'.format(s = server, d = database, u = username, p = password)
会出现以下错误:
文件"。\ sqltest.py",第9行,in connStr =' DRIVER = {SQL Server的ODBC驱动程序13}; SERVER = {s}; PORT-1443; DATABASE = {d}; UID = {u}; PWD = {p}' .format (s = se rver,d =数据库,u =用户名,p =密码) KeyError:用于SQL Server的'
的ODBC驱动程序13