Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
12734 มุมมอง

How to execute sql query on website controller?


I need to get data from a many2many field:

my code:

        self.env.execute('SELECT * from customer_ids')

        res = self.env.fetchall()

     

But this doesn't work in the controllers. Hope you can help me. Thank you.


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
query = "you query goes here"    
request.cr.execute(query)   
data = request.cr.fetchall() 
-------------------------
อวตาร
ละทิ้ง
ผู้เขียน

Thank you so much. It worked.

most welcome

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
เม.ย. 21
5314
How to solved this SQL error ?? แก้ไขแล้ว
1
ก.ย. 21
2949
0
ต.ค. 21
1691
2
ธ.ค. 23
31304
1
มิ.ย. 15
18166