Python Forum
TicTacToe Game Add Exception Handling and Warning Function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TicTacToe Game Add Exception Handling and Warning Function
#2
I am having an error how resolve this

import pyodbc
import datetime
conn = pyodbc.connect('Driver={SQL Server};'
                      'Server=DESKTOP-MBJNNJR;'
                      'Database=master;'
                      'Trusted_Connection=yes;')
cursor = conn.cursor()

cursor.execute('SELECT Employee_Name, Hire_Date FROM Employee WHERE Hire_Date BETWEEN [{%s}] AND [{%s}]')
hire_start = datetime.date(1999, 1, 1)
hire_end = datetime.date(1999, 12, 31)
cursor.execute(query, (hire_start, hire_end))
for (Employee_Name, Hire_Date) in cursor:

    print("{}, {} was hired on {:%d %m %Y}".format(Employee_Name, Hire_Date))
cursor.close()
Error:
ProgrammingError: ('42S22', "[42S22] [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name '{%s}'. (207) (SQLExecDirectW); [42S22] [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name '{%s}'. (207)")
Yoriz write Nov-02-2021, 03:17 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
Invalid Column Name - by ShaikhShaikh - Nov-02-2021, 11:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Star python exception handling handling .... with traceback mg24 3 3,411 Nov-09-2022, 07:29 PM
Last Post: Gribouillis
  create my exception to my function korenron 2 1,472 Nov-09-2022, 01:50 PM
Last Post: korenron
  Array in tictactoe machine not working? Illumimint 4 2,418 Jun-02-2022, 02:24 AM
Last Post: Illumimint
  Exception handling in regex using python ShruthiLS 1 2,901 May-04-2020, 08:12 AM
Last Post: anbu23
  Exception handling Calli 2 3,225 Apr-20-2020, 06:13 PM
Last Post: Calli
  TicTacToe PC vs PC harig3 3 3,057 Mar-28-2020, 01:13 PM
Last Post: harig3
  Handling exception from a module dchi2 11 7,546 Nov-25-2019, 08:47 AM
Last Post: dchi2
  problem using custom exception handling in python srm 3 3,790 Jul-03-2019, 09:10 PM
Last Post: ichabod801
  an easy way to disable exception handling Skaperen 6 7,922 Jun-02-2019, 10:38 PM
Last Post: Gribouillis
  exception handling KyawMyo 3 3,592 May-07-2019, 07:53 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020