Access数据库表单显示弹出而不是插入数据

时间:2016-12-14 15:11:09

标签: sql forms ms-access

我的代码后面有一个按钮

import os
import signal
import subprocess

from time import sleep


parent_pid = os.getpid()
commands = [
    [
        './daemon.py'
    ]
]
popen_list = []
for command in commands:
    popen = subprocess.Popen(command, preexec_fn=os.setsid)
    popen_list.append(popen)


def stop_workers(*args, **kwargs):
    for popen in popen_list:
        print('send_signal', popen.pid)
        popen.send_signal(signal.SIGTERM)

signal.signal(signal.SIGTERM, stop_workers)

for popen in popen_list:
    print('wait_main', popen.wait())

但是当我运行它时,会弹出。

PopUp

我不知道为什么会弹出这个,如果我填入对话框,它会在数据库中插入一个新行。

1 个答案:

答案 0 :(得分:1)

您忘记将单引号放入SQL中,这意味着您的命令变为:

INSERT INTO tblCustomer (CustomerName) VALUES (testnameexample);

为值添加引号...

strSQL = "INSERT INTO tblCustomer (CustomerName) VALUES ('" & name & "');"

使命令成为:

INSERT INTO tblCustomer (CustomerName) VALUES ('testnameexample');