Yii Framework Forum: How can i use dbConnection in the component - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How can i use dbConnection in the component Rate Topic: -----

#1 User is offline   holala 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 23-December 09

Posted 16 January 2010 - 11:18 PM

How can i use dbConnection in the component,i want run sql in the component.
0

#2 User is offline   andy_s 

  • Random Member Title
  • Yii
  • Group: Moderators
  • Posts: 1,526
  • Joined: 22-June 09
  • Location:Russia, Kostroma

Posted 17 January 2010 - 02:20 AM

To get CDbConnection instance: $db = Yii::app()->db;
To get CDbCommandBuilder instance: $builder = Yii::app()->db->commandBuilder;
1

#3 User is offline   holala 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 74
  • Joined: 23-December 09

Posted 17 January 2010 - 04:46 AM

cool!
it's work,thank you very much!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users