|
本帖最后由 ciogao 于 2011-9-26 17:00 编辑
有人说不用mssql,因为是微软的,我也执这个想法,哈哈。
但是有的项目需要啊,.NETer懒得写接口,要从mssql中取数据,怎么办?
还是分享吧。
config中database:
$db['sqlserver']['hostname'] = "192.168.70.59\SQLEXPRESS";
$db['sqlserver']['username'] = "sa";
$db['sqlserver']['password'] = "sa";
$db['sqlserver']['database'] = "LandwindV2";
$db['sqlserver']['dbdriver'] = "mssql";
$db['sqlserver']['dbprefix'] = "";
$db['sqlserver']['pconnect'] = FALSE;
$db['sqlserver']['db_debug'] = FALSE;
$db['sqlserver']['cache_on'] = FALSE;
$db['sqlserver']['cachedir'] = "";
$db['sqlserver']['char_set'] = "utf8";
$db['sqlserver']['dbcollat'] = "utf8_general_ci";
php打开mssql扩展,更新ntwdblib.dll至2000.80.194.0
单php更新有时不成功,将apache中ntwdblib.dll同时更新至2000.80.194.0
ntwdblib.zip
(121.87 KB, 下载次数: 369)
控制器中写法(建议手动连接,节省资源):
function mssqltest(){
$DB_2 = $this->load->database('sqlserver', TRUE);
$query = $DB_2->query("select * from SysUser")->result_array();
dump($query);
}
OK
|
评分
-
查看全部评分
|