我试图让命令工作,但它没有工作帮助请。此错误出现在cmd(“删除
”我有sqlcommand cmd;
#mqttbroker.py
def onMessage(self, callback):
self.client.on_message = callback
self.client.loop_forever()
#database.py
def on_message(self,client,userdata, msg)
#store messsages in db
#main.py
import mqqtbroker
import database
client = mqqtbroker()
client.connect(host, port, 60)
client.onMessage(database.on_message)
答案 0 :(得分:2)
这一行:
cmd("delete blacklist1 where idnumber=@Idnumber", con);
应该是:
cmd = new SqlCommand("delete blacklist1 where idnumber=@Idnumber", con);
但是,您应该将其放在using
块中,以便在完成后释放cmd资源。请参阅:SqlCommand with using statement