I didn't test it but I'm sure it will work if there is only one primary key.
My table has five key fields so I cannot do the solution. I think this is still a problem and should be fixed so it will work without defining 'id' field. db.define_table('EDTPOH00', Field('POIMHF', length=1), Field('PODOCS', length=3), Field('POCTRL', length=20), Field('PODIID', length=5), Field('PODICD', length=20), Field('PODDNO', length=22), Field('POJDNO', length=8), primarykey=['PODOCS', 'POCTRL', 'PODIID', 'PODICD','PODDNO']) On Friday, August 17, 2012 4:58:50 PM UTC-5, Simon Carr wrote: > > I have tested with the solution I posted and it works fine. > > Does it work for you? > Simon > > On 17 August 2012 21:41, Omi Chiba <ochi...@gmail.com <javascript:>>wrote: > >> Actually I have issue #547 for this. >> http://code.google.com/p/web2py/issues/detail?id=547 >> >> >> On Friday, August 17, 2012 3:22:53 PM UTC-5, Simon Carr wrote: >> >>> Hi, >>> >>> I found the answer to this question, so if anyone else is looking for an >>> answer to this question, here is the solution. >>> >>> in your model you need to just add 'id' to the to your primary field >>> here is an example. >>> >>> db.define_table( >>> 'product', >>> Field('id_product','id'), >>> your other fields as usual ........ >>> >>> notice the 'id' which web2py then knows that this should be treated as >>> the ID field that it is looking for. >>> >>> Thanks >>> Simon >>> >>> >>> On 17 August 2012 20:45, Simon Carr <simon...@gmail.com> wrote: >>> >>>> Do I need an ID field in my database when using the SQLForm.grid >>>> >>>> I am reading data from a legacy MySQL database which does not have an >>>> id field. >>>> >>>> Many thanks >>>> Simon >>>> >>>> -- >>>> >>>> >>>> >>>> >>> >>> -- >> >> >> >> > > --