advice pls, how to , mssql

Hi, I’m a newbie. I try to connect with mssql but failed. Would it be possible someone advise me as my code below.

This is the connection string

‘db’=>array(

         'connectionString' => 'sqlsrv:server=dvlserver1;database=Northwind;',


         'username' => 'sa',


         'password' => 'nomsod999$$',


         'charset' => 'utf8',


        ),

This is at Controller

$sql = "SELECT * FROM customers";

	$dataProvider = new CSqlDataProvider($sql,array(


	'pagination' => array(


	'pageSize' => 10,


	),


	));


	


	$this->render('index', array('dataProvider' => $dataProvider));

This is code at View

$this->widget(‘zii.widgets.grid.CGridView’,array(

'id' => 'grid1',


'enablePagination' => TRUE,


'columns' => array(


	array(


	  'name' =>  'customerID',


	  'header' => 'CustomerID',


	      ),


     array(


	  	'name' => 'CompanyName',


		'header' => 'Company',


	       ),


 	 array(


	 	 'name' => 'contractName',


		 'header' => 'Contract',


	 		),


	),

));

This is the Error I have got

[b]The "dataProvider" property cannot be empty.

C:\AppServ\www\MyYii\framework\zii\widgets\CBaseListView.php(103)[/b]

I do apologize first, that I place a lot of code here…

Foon.

As the error suggests, you’ve got to pass a dataProvider property through to the CGridView widget ;)

http://www.yiiframework.com/doc/api/1.1/CGridView

in View [color=#1C2837][size=2]dataProvider in data is missing if Set Data provider in view then solved [/size][/color]

[color=#1C2837][size=2]

[/size][/color]

[size="2"][color="#1c2837"]Example :

[/color][/size][font=Consolas,][size=2]$this->widget(‘zii.widgets.grid.CGridView’, array([/size][/font][font=Consolas,][size=2]

'dataProvider' => $model->search(),[/size][/font][font=Consolas,][size=2]


'filter' => $model,[/size][/font][font=Consolas,][size=2]11    'columns' => array([/size][/font][font=Consolas,][size=2]12        array([/size][/font][font=Consolas,][size=2]13            'name' => 'username',[/size][/font][font=Consolas,][size=2]14            'type' => 'raw',[/size][/font][font=Consolas,][size=2]15            'value' => 'CHtml::encode($data->username)'[/size][/font][font=Consolas,][size=2]16        ),[/size][/font][font=Consolas,][size=2]17        array([/size][/font][font=Consolas,][size=2]18            'name' => 'email',[/size][/font][font=Consolas,][size=2]19            'type' => 'raw',[/size][/font][font=Consolas,][size=2]20            'value' => 'CHtml::link(CHtml::encode($data->email), "mailto:".CHtml::encode($data->email))',[/size][/font][font=Consolas,][size=2]21        ),[/size][/font][font=Consolas,][size=2]22    ),[/size][/font][font=Consolas,][size=2]23));

[/size][/font][font=Consolas,][size=2]Sample u Have Missed out bellowed thing in your code[/size][/font][font=Consolas,][size=2]

[/size][/font][font=Consolas,][size=2] ‘dataProvider’[color=#000000] [/color]=> $model->search(),[/size][/font]