select no param

This commit is contained in:
Bartal Læarsson
2026-02-16 13:55:15 +00:00
parent e9e1e99a97
commit 79a39212d7
3 changed files with 67 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import pyodbc
print()
try:
connection = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER=.;DATABASE=SampleDB;Trusted_Connection=yes')
cursor = connection.cursor()
cursor.execute("select @@version as version")
while 1:
row = cursor.fetchone()
if not row:
break
print(row.version)
cursor.close()
connection.close()
except pyodbc.Error as ex:
print()
print("exception: ",ex)
print("closing program")
print()
exit()
print()