我试图从数组中将行插入表中,但是会发生错误:TypeError
以下是代码:
data = []
connsql = pymssql.connect(server='servername', user='username',
password='password', database='database')
cursorsql = connsql.cursor()
for i in data:
tsql = 'insert into ComputerName_IPAddress (ComputerName,IPAddress,TimeStamp) values'
tsql += "('"+i[0]+"','"+i[1]+"',GETDATE())"
cursorsql.execute(tsql)
cursorsql.close()
connsql.close()
但发生错误:
tsql += "('"+i[0]+"','"+i[1]+"',GETDATE())"
TypeError: must be str, not NoneType
数组数据包含以下行:
('ZRI-1234', '10.746.60.15')
('ZUZ-1207', '10.716.70.53')
如何解决?