I am building a web app using Django framework of Python , DB is Sql server Azure ,using Pyodbc.
I have an issue i am unable to resolve , i am getting a parameter(file_name) which is a string and when running the query with the parameter i am getting empty results in the first case and
"sql = sql % tuple('?' * len(params))
TypeError: not all arguments converted during string formatting"
in the 2nd case , what am i doing wrong?
file_name=request.POST.get('filetodelete')
with connections['default'].cursor() as c:
1st case
parms=[file_name]
sql='select * from banks_row_data where file_name=%s'
c.execute (sql,parms)
test=c.fetchall()
2nd case
c.execute (sql,file_name)
test=c.fetchall()