我正在尝试将变量插入到sql数据库中。 我的代码看起来像这样:
mysql = require "luasql.mysql"
env = luasql.mysql()
conn = env:connect('try','root','root123')
print(env,conn)
file=(io.open("C:\\Calls2.1.txt","r"))
otherFile = (io.open("C:\\newFile.txt","a"))
file:seek("set","0")
for line in file:lines() do
l = line
t={}
i=1
for word in (l .. ","):gmatch("([^,]*),") do
print(word)
table.insert(t, word)
conn:execute([[insert into dealtemplatedata values('1','111',tonumber(word),word])]])
end
但表格中没有任何内容。 有没有办法做到这一点?