i have a django project that is connected to SQL Server i tried to retrieve data from the database.
if i try to display all the data it run correct and display all the values.
but if i try to display the data in an **html table** it doesn't display anything.
views.py
=======
def connect(request):
conn = pyodbc.connect(
'Driver={ODBC Driver 17 for SQL Server};'
'Server=DESKTOP-LPD1575\\SQLEXPRESS;'
'Database=testDB;'
'UID=test;'
'PWD=test;'
)
cursor = conn.cursor()
c = cursor.execute('SELECT * FROM Artist')
return render (request,'connect.html',{"c":c})
connect.html
========
{% for row in c %}
{{ row }}
{% endfor %}
this code in the html template work and display the data.
but if i try to do as below it will not work
<table align = "center">
<tr align="center">
<th>ID</th>
<th>FolderNumber</th>
<th>Title</th>
</tr>
{% for row in c %}
<tr align="center">
<td>{{ row.artistName }}</td>
<td>{{ row.activeFrom }}</td>
</tr>
{% endfor %}
</table>
anyone can help me?