First, if you're in the shell, you need to do db.commit() for your DB
transactions to be committed (see
http://web2py.com/book/default/chapter/06#commit-and-rollback). Also, if
you're using the web-based shell via the 'admin' app, sometimes it doesn't
work so well -- you might be better off using the regular Python shell
starting from command line (see
http://web2py.com/book/default/chapter/04#Command-Line-Options).
I'm not sure why it wasn't working from 'appadmin' (i.e., the Models
database administration screen) -- what did you see there?
Anthony
On Monday, August 1, 2011 1:37:05 AM UTC-4, Andrew wrote:
> Hello,
> I'm experimenting with using legacy tables, and I've created a test
> table in MS SQL, inserted some rows(through SQLServer Studio), and I
> can now see the rows in a very simple View.
>
> I have tried to Insert rows into this table through the Models
> database administration screen, as well as using the Controllers
> shell. db.web2pytest_leg.insert(LoadName='blah', DestinationName =
> 'blah2', Description = 'blahblah')
>
> This doesn't come back with any errors but doesn't insert anything
> either. There is no feedback on the shell that it did anything.
> Another point, which may be a related symptom, is that when I then run
> "print db._lastsql" I just get the command echoed back to me and no
> sql. There are no errors in the log.
>
>
> my db.py file includes:
>
> db.define_table('web2pytest_leg',
> Field('LoadName', 'string'),
> Field('DestinationName', 'string'),
> Field('Description', 'string'),
> primarykey=['LoadName'],
> migrate=False
> )
> I've also tried running with fake_migrate=True for a while too.
>
> Any ideas please. I've browsed through the forum for a while but I
> can't see this issue. Thanks.