尝试使用ormlite中的存储过程进行更新。我目前有这个,但它似乎没有工作。没有显示错误,只是什么也没做。
from multiprocessing import Process
import socket
direction = "localhost"
global s
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
def send_messages():
s.connect((direction, 5124))
while True:
message = raw_input('> ')
s.send(message)
if message == 'close':
break
print 'Bye'
s.close()
def receive_messages():
s.bind(("localhost",5124))
s.listen(2)
sc, addr = s.accept()
while True:
message = sc.recv(1024)
print message
sc.close()
s.close()
if __name__ == '__main__':
p1 = Process(target = receive_messages)
p1.start()
p2 = Process(target = send_messages)
p2.start()
p1.join()
p2.join()
还有什么可以解决删除问题?
答案 0 :(得分:1)
如果存储过程没有返回任何内容,请改为使用db.ExecuteSql(),例如:
db.ExecuteSql("exec updateUsers @Username, @password, @id_room, @id_rol",
new { Username = users.Username,
Password = users.password,
Id_room = users.id_room,
id_rol = users.id_rol });
与删除相同:
db.ExecuteSql("exec deleteUsers @Username, @password, @id_room, @id_rol",
new { Username = users.Username,
Password = users.password,
Id_room = users.id_room,
id_rol = users.id_rol });