Hello,
I have created a list of fields in the database. For example,
How to use this list in the SQL command, instead of writing all the field names?
I tried 2 types of code:
The error message I get is: pypyodbc.DatabaseError: ('07002', '[07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.')
Thank you.
I have created a list of fields in the database. For example,
1 |
varlist = [ 'id' , 'grade' , 'age' , 'fname' , 'lname' , 'projTitle' ] |
I tried 2 types of code:
1 2 |
sqlcommand = ( "select (varlist) from table1" ) cur.execute(sqlcommand) |
1 2 |
for fld in varlist: cur.execute( "select fld from table1" ) |
Thank you.