El martes, 23 de abril de 2013 12:53:30 UTC-3, v1s escribió:
>
> Can someone help me by giving me an example on how to connect to SQL 
> server using web2py, select records from a table and display it.
>  
> I am not able to get any specific examples with regard to SQL server. 
> Sorry if my question is very basic/broad..Thanks in advance!
>  
>  
> Thanks
>  
>  
> PS: I think I posted the same question as "Ask a question". Sorry for 
> double posting
>


I connect in this way:

db = DAL <http://127.0.0.1:8001/examples/global/vars/DAL>(
"mssql://dsn=my_dsn;UID=user;PWD=pwd") 

about how to query data from a table, this is independent of the database 
server.

if the table already exists in the database, you must define it in the 
model with migrate = False

Example:

In model:

db.define_table('mytable',
    Field(...),
    ...,
    migrate=False
)

in controler:

def test():
    rows = db(db.mytable).select()
    return dict(rows=rows)

You can see more in [1]

Best Regards,
José



[1] http://www.web2py.com/books/default/chapter/29/06

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to