I found the reason.  I needed to add  user_signature=False

The default for this parameter is True and will prevent you from adding 
records!!!
On Thursday, January 18, 2024 at 1:47:37 PM UTC+1 Davidiam wrote:

> I recently switched from sqlite to MS SQL and my application no longer 
> allows me to add new records using the smartgrad.  I have editable and 
> deletable set to True but I can only view the records.
>
> If I use a basic SQLFORM I can add records, but I would prefer using the 
> smartgrid.
> Is there a trick to getting it working with MS SQL?
>
> This only allows me to view the record:
>     grid = SQLFORM.smartgrid(db.image, create=True, editable=True, 
> deletable=True, linked_tables=['post'])
>     return dict(grid=grid)
>
> With this is I can add new records:
>     record = db.image(request.args(0))  # Tries to get  an existing record 
> where the id is specified in the first argument if the url.
>     
>     image_form = SQLFORM(db.image, record)  # Creates a form based on the 
> 'image' table. If a record was found, it will show the record details 
>     
>     if image_form.process().accepted:  # When the form is submitted (not 
> when it is created) it will try and process it and add the record or save 
> any changes to the record.
>         response.flash = 'form accepted' 
>     elif image_form.errors:
>         response.flash = 'form has errors'
>     return dict(grid=image_form)
>
> Kind Regards,
> David
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/74fe3183-a0ef-4cc7-9690-3a870be6ef73n%40googlegroups.com.

Reply via email to