我想在 python 代码中使用存储过程,如下所示。
import pyodbc
conn = pyodbc.connect('Trusted_Connection=yes', driver = '{SQL Server}',
server = 'ZAMAN\SQLEXPRESS', database = 'foy3')
def InsertUser(studentID,name,surname,birth,address,telephone):
cursor = conn.cursor()
cursor.execute("exec InserttoDB studentID,name,surname,birth,address,telephone")
rows = cursor.fetchall()
我在部分代码下面有问题。如何使用 InserttoDB(存储过程)将函数参数发送到 DB
cursor.execute("exec InserttoDB studentID,name,surname,birth,address,telephone")