I am not aquainted with SQL Server and neither with pandas. But are you sure you are using the right syntax? Should it not be:
Just saw your message. I think you have too many brackets ().
And post the error message if you have one. Don't take it personal but people seem to not realize the error is not just some text, it is designed to tell you exact why python cannot execute what you coded.
Note there is a button to post error messages.
pd.read_sql_query(SQL, conn, params=(userid, rolename))And when everything fails you can always change the SQL string:
... userid, rolename = row[['User Id', 'Role Name']] SQL = f"select * from tablename where userid = '{userid}' and roleName = '{rolename}'" sql_query = pd.read_sql_query(SQL, conn) ...And don't forget, if anything happens you don't understand: insert print statements to see what the program really does.
Just saw your message. I think you have too many brackets ().
And post the error message if you have one. Don't take it personal but people seem to not realize the error is not just some text, it is designed to tell you exact why python cannot execute what you coded.
Note there is a button to post error messages.