May-24-2024, 04:07 PM
Hello,
When I ran the following code, it got the message "No results. Previous SQL was not a query." How do I get the dataset returned from the stored procedure? Thank you.
When I ran the following code, it got the message "No results. Previous SQL was not a query." How do I get the dataset returned from the stored procedure? Thank you.
conn_str = ('DRIVER={SQL Server};SERVER=' + server + ';DATABASE=' + database + ';Trusted_Connection=yes;') cnxn = pyodbc.connect(conn_str) cursor = cnxn.cursor() sp = "EXEC spTest" dataset = cursor.execute(sp) df_Test = dataset.fetchall() print(df_Test)